Using Animations after :LoadAnimation deprecated

:LoadAnimation has been deprecated so how do play animations now?

I tried simply doing:

script.Parent.Animation:Play()

It does not work. I found out there is something called the animator which I need to use but I do not understand it. What do I do?

Humanoid.Animator:LoadAnimation()

That is only client-sided. Will not replicate

It should replicate perfectly. Why wouldn’t it?

Not sure, but you can still use it

local Animation = script.Parent.Animation
local Humanoid = script.Parent.Humanoid

local LoadedAnimation = Humanoid:LoadAnimation(Animation)
LoadedAnimation:Play()

you call :LoadAnimation() on the animator, it’s only deprecated on humanoids, and it will actually replicate more reliably according to documentation (which is the whole reason it got deprecated in the first place)

2 Likes

Humanoid:LoadAnimation() is deprecated, you need to use Humanoid.Animator:LoadAnimation()

1 Like

is factually wrong, you dont need to use it, but it is discouraged to use Humanoid:LoadAnimation()
due to the afformentioned replication reliability

I still use :LoadAnimation() on the humanoid in my games, and it work’s perfectly.

Actually this isn’t 100% true, the Animator is being undocked from Humanoid, you should be using the animator class directly now.

Read more here: Deprecating LoadAnimation on Humanoid and AnimationController

As for your issue, you cant play Animations directly, you need to load them into an AnimationTrack before playing it
image

local Animation = script.Parent.Animation
local AnimationTrack = script.Parent.Humanoid.Animator:LoadAnimation(Animation)
AnimationTrack:Play()
1 Like

It will replicated… It’s like Humanoid:LoadAnimation()
image

To be honest, I suggest using:

local Animation = script.Parent.Animation
local Animator = script.Parent.Humanoid.Animator

local LoadedAnimation = Animator:LoadAnimation(Animation)
LoadedAnimation:Play()

Instead of that.

1 Like

Since some people are arguing about using the humanoid or the animator instance, when you speak of “deprecated”, it means it’s no longer supported or updated on.

The animator instance also only replicates if it was added from the server side and not the client side or unless if you inserted it in manually.

So the difference is that animator is more stable and can replicate and can play animations instantaneously without worrying having to play it all at once in the server sided to make it play for everyone, while playing it in the humanoid doesn’t replicate (unless if it’s on a server sided script, correct me if i’m wrong) and is no longer supported.

So i prefer using the animator instance to load and play animations on rather than humanoid or animation controllers so it’s more smoother and stable.