Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to stop animations?

I'm using a looping animation I made in animation editor

workspace.Player1.Humanoid:LoadAnimation(workspace.LobsterAnim):Play()

But when I try to stop it

workspace.Player1.Humanoid:LoadAnimation(workspace.LobsterAnim):Stop()

It keeps playing. I tried deleting the animation also and it still keeps playing.

How do I make it stop?

1 answer

Every time you call LoadAnimation a new AnimationTrack is created. When you try to stop the animation, you call LoadAnimation a second time. This creates a new AnimationTrack separate from the one that's actually playing! Therefore, when you stop it, nothing happens.

Store a single AnimationTrack in a variable, then play it and stop it as you wish. In pseudo code it would look like this:

local animTrack = Humanoid:LoadAnimation(animation)
animTrack:Play()
wait(1)
animTrack:Stop()

This discussion is preserved as it was. New answers, comments, and votes are closed.