My animation won't stop playing

I’m simply trying to stop the animation from playing, though it consists even when told to stop.

model.Animations.Dance.AnimationId = "rbxassetid://12178916567"
print("Dance.")
model.Humanoid:LoadAnimation(model.Animations.Dance):Play()
wait(2)
print("Stop dancing.")
model.Animations.Dance:Stop()

The script prints everything, though it seems to ignore the stopping request instead with the error,
“Stop is not a valid member of Animation”. I’ve tried to replace the stop animation line with:

model.Humanoid:LoadAnimation(model.Animations.Dance):Stop()

This results in no error, but the animation still does not stop. What am I doing wrong?

Thats not how it works, Create a Variable to Store the Playing Animation (aka the Loaded Animation)

local Animation = model.Humanoid:LoadAnimation(model.Animations.Dance) -- AnimationTrack
Animation:Play() -- Plays Animation Track

So, In this sense, we can Stop it:

Animation:Stop()

If you pay attention to the function, It returns an AnimationTrack

:LoadAnimation(Animation): AnimationTrack -- "AnimationTrack" is what the function is returning
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.