Okay, I’m having an issue with animations. It stops when I need it to stop, but it waits 5 seconds for it to go stop and i dont know what the issue is. This is simple code, if the Blocking gets destroyed it waits 5 seconds and then stops. Does anybody know what the issue is? I dont have any task.wait()s in the code.
while task.wait() do
if script.Parent:FindFirstChild("Blocking") then
loader = script.Parent.Humanoid.Animator:LoadAnimation(script.Animation)
loader:Play()
else
loader:Stop()
end
end
Not much to go on there but guessing you are using an animation on loop while attacking a “Blocking” and the “Blocking” is some sort of breakable wall assuming with something like HP which depletes before it breaks? [If it’s a PvP thing need more info.]
You could add in another simple variable and do something like if Blocking HP = 0 then loader:Stop() instead of the else, might make it more responsive. Without also seeing the blocking code hard to say.
I’m pretty sure that it’s because the script loads and plays the animation every frame without stopping the previous one
which means that when Blocking gets destroyed, the script stops the newest loaded animation but the previous ones are still playing