How can I stop an animation?

There’s this animation I want to stop but whenever I refrence the animation ex: game.Workspace.Animation:Stop() It says that stop is not a valid member of Animation why is this am I just stupid?

10 Likes

Could you please show us your workspace and code?

2 Likes

in the script where you play the animation it should be something like this:

local anim = workspace.Animation
local humanoid = plr.Character.Humanoid
local animtrack = humanoid:LoadAnimation(anim)

animtrack:Play()
--to stop it just
animtrack:Stop()
2 Likes

Thanks, this helped and I kinda already knew this the problem was I was struggling with defining variables and needed to define variables outside the function Thanks!

2 Likes

Humanoid:LoadAnimation() is deprecated. Please refrain from using it in posts related to animations.

3 Likes

What do you mean isnt this the way to play animations?

2 Likes

Sorry, I didn’t know it was deprecated as I don’t use it at all, and only knew that it was a way to load animations.

2 Likes

You can still load it that way but I recommend you don’t use deprecated methods.

New LoadAnimation method is;
Humanoid:WaitForChild(“Animator”):LoadAnimation()

15 Likes

So wait are you storing this animation in the humanoid and if so whats different from his method?

2 Likes

Also it wont stop animation still for some reason

3 Likes

Try doing this (also dance it’s the animation but loaded on the humanoid)
dance:Play() wait(dance.Length) dance:Stop()

4 Likes