What is the syntax for loading animations now?

I’ve searched on the Developer Hub, and noticed that Humanoid:LoadAnimation was deprecated. What is the new syntax, and why was it deprecated?

Also, why isn’t AnimationController:LoadAnimation deprecated as well, it uses the same function name to load animations?

Edit:

I found another :LoadAnimation function for an Animator object. Is that the function I should be using?

2 Likes

Humanoid:LoadAnimation() is deprecated because it would create 2 Animator objects inside a humanoid. The use of this function is to create an Animator object inside the humanoid if it doesn’t have that Animator object. The reason why is deprecated is maybe because the function would create 2 animators and spoil the AnimationController.

The best alternative is to use Animator:LoadAnimation(), a child of the humanoid of a player’s character model. If you are using NPCs, use Humanoid:LoadAnimation() as you can’t create an Animator object inside them.

4 Likes