Hi, i'm making a burst fire gun which does infact work. It needs to not get spammed, i've tried making a cooldown but it didn't work. Basically, I want to add a debounce before you can start shooting again.
Here is the scripts.
Tool
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local pistol = script.Parent
local tool = script.Parent
script.Parent.Activated:Connect(function()
for i = 1,3 do
print(mouse.Target)
local Target = mouse.Target
workspace.WeaponFired:InvokeServer(plr, Target, pistol)
wait(0.8)
end
end)
ServerSide
local FiredWep = workspace.WeaponFired
FiredWep.OnServerInvoke = function(plr,A1,A2,A3)
print(A1,A2,A3)
A2.Parent.Humanoid:TakeDamage(35)
for i = 1,3 do
if A2.Name == "Head" then
A2.Parent.Humanoid:TakeDamage(125)
wait(.65)
end
end
end
[SerpentineKing]: Added Proper Indentation

1 comment
Go to the wicky article about denounce it’ll explain in well