How can i temporarily disable all idle animations?

Im making a game similar to the popular irl game shadow boxing. I have animations playing where a users head would go left or right, etc.

Although after a while the idle look around animation plays for the users characters. The game animations play while their idle animation plays and it gets confusing. How can I make it so that when they’re in battle their idle animation cant play.

Thanks!

4 Likes

You can go to the character’s animate script and remove the idle animation id
(save it in a variable then remove it)

When it comes to stopping idle animations already playing, there are a couple ways you can do this, both of which involve using Humanoid.Animator:GetPlayingAnimationTracks().

The simple way is to call GetPlayingAnimationTracks, iterate through all of them, and stop the ones whose AnimationPriority are “Idle.”

A more complicated solution is putting a BoolValue in your animation objects, set it true for the animations you want to stop in this case, and then canll GetPlayingAnimationTracks and go through each one, stopping the ones whose Animation objects (AnimationTracks have an “Animation” property calling back to the objects they were loaded from) have one of these BoolValues set to true. Edit: I suppose this also could just be done by adding an Attribute to the Animation objects, but I haven’t used that feature much, so it did not come to mind at first.

As for preventing these animations from beginning to play to begin with, that would require making your own custom animation scripts that check for these scenarios.

Overall, I’d recommend looking at API documentation if anything I mentioned seems unfamiliar to you.

-Edited thanks to feedback.

1 Like

That function is deprecated for the Humanoid object, you should call it on the Animator instead.

1 Like

In theory this would work but after doing more research for some reason many idle animations made by roblox are put under the “core” priority.

1 Like

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