local clicked = false
tool.Activated:connect(function()
if not clicked then
clicked = true
if swing1 and humanoid and humanoid.Health > 0 then
local swingAnim = humanoid:LoadAnimation(swing1)
swingAnim:Play()
end
clicked = false
end
end)
COMMUNITY QUESTION
why doesnt the debounce affect this animation?
1 answer
The method Play only plays the animation but also continues the code so you are resetting the denounce not waiting till the animation finishes.
local clicked = false
local swingAnim = nil -- store animation
tool.Activated:connect(function()
--check animation status
if swingAnim ~= nil then
clicked = swingAnim:IsPlaying () -- now check that the animation has finished
end
if not clicked then
clicked = true
if swing1 and humanoid and humanoid.Health > 0 then
local swingAnim = humanoid:LoadAnimation(swing1)
swingAnim:Play()
end
-- clicked = false we now don't need this
end
end)
Hope this helps comment if you need any more info
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
turns out it was because i didnt add a wait()
just a note but wait() is not exact u chould use tick() to accreatly mesure time