I’m trying to make it so my NPC is able to move using the Humanoid:MoveTo() function and make it have a walking animation, and I don’t know how to do this. Any help would be appreciated.
In the controlling script use the following to load the animation to the NPC, assuming your NPC is defined as
local newAnimator = Instance.new("Animator") newAnimator.Parent = npc.Humanoid local npcWalk = npc.Humanoid:WaitForChild("Animator"):LoadAnimation(script.WalkAnim) local npcIdle = npc.Humanoid:WaitForChild("Animator"):LoadAnimation(script.IdleAnim)
Then after your MoveTo: event you just play the animation:
npc.Humanoid:MoveTo(randomPos) npcWalk:Play() npc.Humanoid.MoveToFinished:Wait() npcIdle:Play()