LoadAnimation():Stop() Not Working?

Hello,

For some reasons, LoadAnimation():Stop() randomly stopped working.

I was making a potion with a custom animation. While LoadAnimation():Play() does work, LoadAnimation():Stop() doesn’t. So now, the animations never stops looping.

My script I used was something like this:

script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.R6Animation):Stop()

Is there anything i can do to fix this problem?

Thank you!

2 Likes

Why don’t just define the loaded animation?

local Animation = AnimationTrack:LoadAnimation();

--<Then call the Stop() and Play() Functions
Animation:Play(); wait(5); Animation:Stop()

You said your way used to work before, but Stop() isn’t deprecated.

6 Likes

Define the animation into the variable. Not sure how your code worked before, because you’re loading 2 different animations, and stopping a newly loaded one!

Use the code provided by @MightTea, that code should work find for you.

1 Like

Save the AnimationTrack in a variable.
In the example of your code the function LoadAnimation returns an instance called AnimationTrack and it has the function called Play and Stop.

local animTrack = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.R6Animation)
--Then you use play or stop on that animation track
animTrack:Play()
wait(1)
animTrack:Stop()

No, there wasn’t any errors in the output.

It worked! Thank you so much! The way I used the variable was like this:

anim = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.R6Animation)
anim:Play()

Might as well check for the other animation tools I made. Thanks again!

1 Like

I think this would be the correct way

local AnimationTrack = Humanoid:LoadAnimation(Animation);

AnimationTrack:Play();