Alternative for humaoid:LoadAnimation()

So I discovered that humaoid:LoadAnimation() is depreciated but I can’t figure out another way to load an animation.

I saw in the Roblox Developer Educational Page that they use the “Animator” in the character to load animations but I can’t insert this “Animator” property.

What other ways can I load an animation to the character/NPC?

Current Code:

local animationwave = Instance.new("Animation")
animationwave.AnimationId = "rbxassetid://7008128758"

local animationpoint = Instance.new("Animation")
animationpoint.AnimationId = "rbxassetid://7213070154"

local waveTrack = script.Parent:LoadAnimation(animationwave)
local pointTrack = script.Parent:LoadAnimation(animationpoint)

waveTrack.Looped = true

wait(1)

waveTrack:Play()
wait(5)
waveTrack:Stop()

wait(1)

pointTrack:Play()

Humanoids already have an Animator inserted in them so there’s no real need to insert it yourself, just reference the Animator like you would any other instance and it should work

This is only true for automatically loaded characters, not Humanoids inserted in studio.

To insert an animator, use

local Animator = Instance.new("Animator", Humanoid)

in the terminal. I don’t think you can insert them in studio using the object finder. You can also play test the game and copy the Animator from your humanoid, then paste it into the Humanoid in studio.

1 Like