How to animate my walking NPC?

I have this NPC walking about in my game but the animations won’t play on him. I never deal with animating very often and I need some help with animating my NPC.

image

He just walks around stiff as a rock, and since the running animation wasn’t working, I decided that the idle won’t work too. Here is my code with the problems. There are no errors, it’s just that nothing happens.

local npc = script.Parent

local runAnim = script.Parent.Humanoid:LoadAnimation(script:FindFirstChild("RunAnim"))

runAnim.Looped = true

while wait(10) do

local randomlocation = Vector3.new(math.random(-87,40), 0, math.random(-3,81))

runAnim:Play()

npc.Humanoid:MoveTo(randomlocation)

runAnim:Stop()

end
1 Like

You need to add
npc.MoveToFinished:Wait()
after this script will wait until npc go to point and stop animation.
In your script animation stops in miliseconds after it started.

1 Like