Hum:LoadAnimation(Anim) does not work? Any alternative

So I was coding today and setting something up for loading animations. Only problem is.
It appears Hum:LoadAnimation() is removed or something.

So is there anyway to do this instead? Cause I have no idea how to do it

Humanoid:LoadAnimation is deprecated as far as I know, the alternative is Animator:LoadAnimation(), the animator is located in the humanoid I think

Humanoid:LoadAnimation was deprecated a few years back. You’re supposed to use Animator:LoadAnimation. Animator is a descendant of the Humanoid Instance.

-- Play an animation using Animator
local function getAnimator(humanoid: Humanoid): Animator
   local animator = humanoid:FindFirstChildOfClass("Animator") -- get a pre-existing animator first
   if not animator then -- if the humanoid doesn't have an animator, create it
       animator = Instance.new("Animator")
       animator.Parent = humanoid
   end

   return animator -- return the animator Instance
end

-- Animator:LoadAnimation works the same way as Humanoid:LoadAnimation
getAnimator(Humanoid):LoadAnimation(Animation)

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