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)
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