Hi, i have a little problem:
(sorry for bad english). I need to insert a delay in this function for 0.5 Seconds. You can activate this function only 1 time for every 0.5 seconds. It's simple, but i don't know how i can do it >.<.
tool.Activated:connect(function()
local choose = math.random(1,2)
canattack.Value = true
if choose == 1 then
local swing1animation = script.Parent.Parent.Humanoid:LoadAnimation(script.Punch1)
swing1animation:Play()
wait(.2)
swingsound:Play()
elseif choose == 2 then
local swing2animation = script.Parent.Parent.Humanoid:LoadAnimation(script.Punch2)
swing2animation:Play()
wait(.2)
swingsound:Play()
end
end)
Thanks!

1 comment
Use debounce:
https://www.youtube.com/watch?v=HoZkuvd6RPA https://scriptinghelpers.org/questions/3079/someone-please-explain-debounce