Animations not stopping even after Animation:Stop()?

Hello! I am currently scripting a “Zombie” system for my game, however, I’m trying to stop every playing animation from the player’s character once they become a zombie to stop problems like playing looping animations and my zombie idle animation overlapping (which is one of the problems I’m having).

Problem is, the animation isn’t stopping, even when I tell them to. Here is my shortened code:

IsZombie.Changed:Connect(function()
	if IsZombie.Value == true then
		for i, v in pairs(char.Humanoid.Animator:GetPlayingAnimationTracks()) do
			print(v)
			v:Stop()
		end
end
end)

For context, “IsZombie” Is a value located in the character, just making sure it doesn’t get confusing (which probably will). Also, the print works fine, it’s pasting in the output the playing animations. The animation I’m having problems with is triggered by the press of a button, and not with a While true do or RenderStepped loop.

Any help is appreciated! :slight_smile:

1 Like

Off the top of my head, two things could be happening:

  • Whatever’s telling you to play your non-zombie animations is still running despite you becoming a zombie, thus causing the animations to resume after being stopped

  • The client is trying to stop an animation owned by the server, thus not really working

It could be something else, but I’d look into these two potential culprits first

2 Likes

I can confirm the first one not being true, the non-zombie animation that’s causing me problems right now is only activated by a function, although I do need to try to second one, which I’ll do now.

Thank you so much! It appears to be working now (aside from my terrible code due to me being really tired) I was about to collapse from how stressed I was and how tired I am.

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