I am attempting to give an NPC a walking animation, that activates when he walks to a destination, to another. No matter what animation I load and play, it does not work and the NPC moves without walking, what is wrong within the script?
local PatrolPoints = game.Workspace["Patrol Route"]
local humanoid = script.Parent:WaitForChild("Humanoid")
local attack = false
local anim = script.Parent.Animation
local animTrack = humanoid:LoadAnimation(anim)
while attack == false do
for patrol = 1, #PatrolPoints:GetChildren() do
animTrack:Play()
humanoid:MoveTo(PatrolPoints[patrol].Position)
humanoid.MoveToFinished:Wait()
animTrack:Stop()
wait(5)
end
end