I new in scripting and my english is bad, sorry. I want to make a gun script, but i dont know how to delay a Activated event, so please help me (im using LocalScript)
wait(5) local plr = game:GetService("Players").LocalPlayer local hum = plr.Character:WaitForChild("Humanoid") local tool = script.Parent local anim = script.Parent.Animation local animtrack = hum:LoadAnimation(anim) local sound = game.Workspace.Sounds.shoot tool.Equipped:Connect(function() animtrack:Play() end) tool.Unequipped:Connect(function() animtrack:Stop() end) tool.Activated:Connect(function() sound:Play() wait(2) --wait isnt delaying end)
I found solution
local debounce = false local sound = game.Workspace.Sounds.shoot tool.Activated:Connect(function() if not debounce == true then debounce = true sound:Play() wait(2) debounce = false end end)