I watched the vid and copied it down it works well but theres alot of bugs.
Then I watched Gamer M8’s vid on this but inproved version of TheEvilDuck’s scripts his also had bugs every time you re-equip the gun it bassically fires of 2 bullets and re-equip again it fires of 3 and etc but dmg is same but it takes more bullets when u re-equip and u could spam click on a player to bassically instantly kill them I don’t know how to make it so you can’t fire off bullets every second or something
This is Gamer M8’s script
Main script (Local Script)
`
local maxAmmo = 15
local Ammo = maxAmmo
local reloading = false
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild(“PlayerGui”)
local textLabel = playerGui:WaitForChild(“M9AmmoDisplay”):FindFirstChild(“AmmoText”)
script.Parent.Equipped:Connect(function(Mouse)
local function reload()
reloading = true
wait(1)
Ammo = maxAmmo
reloading = false
end
script.Parent.Activated:Connect(function()
if Ammo > 0 and not reloading then
Ammo = Ammo - 1
script.Parent.GunShot:Play()
if Mouse.Target.Parent:FindFirstChild("Humanoid")then
script.Parent.DealDamage:FireServer(Mouse.Target.Parent, 10)
end
elseif reloading == false then
reload()
script.Parent.GunShot:Stop()
end
while wait()do
textLabel.Text = (Ammo).."/"..maxAmmo
end
end)
local Input = game:GetService("UserInputService")
Input.InputBegan:Connect(function(Key)
if Key.KeyCode == Enum.KeyCode.R and reloading == false and Ammo ~= maxAmmo then
reload()
end
end)
end)`
And the dmg script (Remote Event)
script.Parent.DealDamage.OnServerEvent:Connect(function(player,Target,Damage) Target.Humanoid:TakeDamage(Damage) end)