How to stop a particular animation?

This solution uses a deprecated function. However, I found an undocumented function that may be helpful. How do I know exactly which animation to stop? Can I name my animation track?

1 Like

I think the animation tracks will be named by the name of the Animation instance it came from. You can try it out by making a loop using Humanoid.Animator:GetPlayingAnimationTracks() and printing all the names of the tracks playing currently, from there you should see the animation you want to stop and you can just make an if statement to stop that particular AnimationTrack via checking the name

Some pseudo code as an example

for _,anim in pairs(Humanoid.Animator:GetPlayingAnimationTracks()) do
	print(anim.Name)
	if anim.Name == "SwordDash" then
		anim:Stop()
		break
	end
end

If the current animation in the iteration is called SwordDash, it’ll stop it and break the loop

7 Likes