New method for animating NPCs on the server?

I tried using LoadAnimation but it’s deprecated so i’d rather not risk it, what’s the current way to do it on the server side?

Humanoid:LoadAnimation has been deprecated so you have to use Animator:LoadAnimation

1 Like

Thanks, for anyone finding this in the future here is the code i used.

local Pool = {} -- Put id's here

local Humanoid = script.Parent:FindFirstChild("NPCHumanoid")
local Animator = Humanoid:FindFirstChildOfClass("Animator")

local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://"..Pool[math.random(1,#Pool)]

local AnimationTrack = Animator:LoadAnimation(Animation)
AnimationTrack.Looped = true

AnimationTrack:Play()