Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does this animation not stop?

Asked by
udoxas 75
8 years ago

I'm trying to get an animation to play when you equip the tool. It works fine at first, but you're stuck in the animation afterwards. Here's the code:

script.Parent.Equipped:connect(function(m)
        hum = game.Players.LocalPlayer.Character.Humanoid
        anim_feet = hum:LoadAnimation(script.Parent.Hold)
        current = anim_feet
        current:Play()
end)

script.Parent.Unequipped:connect(function(m)
    current:Stop(0)
end)

1 answer

Log in to vote
-1
Answered by
Chronomad 180
8 years ago

Try adding

for _,v in pairs(P.Character.Humanoid:GetPlayingAnimationTracks()) do v:Stop(0.4) end

After line 2.

0
Thanks - it worked. I had to replace the "current:Stop(0)" part instead of line 2, but after that it was all good. udoxas 75 — 8y
Ad

Answer this question