NPC stops when the speed is modified

I want the R15 NPC to walk straight down the aisle with an animated walk. Therefore, I need to set the WalkSpeed lower to match the animation. When the speed is set to anything under 9, it does not reach the destination. The slower the speed is, the less distance it travels.

local animationId = "rbxassetid://18333836373"
local npc = script.Parent
local humanoid = npc:WaitForChild("Humanoid")
humanoid.WalkSpeed = 9

local animation = Instance.new("Animation")
animation.AnimationId = animationId

local animationTrack = humanoid:LoadAnimation(animation)
animationTrack:Play()
wait(10)


local designatedPart = game.Workspace.SpawnLocation

local function moveToDesignatedPart()
	local targetPosition = designatedPart.Position

	humanoid:MoveTo(targetPosition)

	humanoid.MoveToFinished:Connect(function(reached)
		if reached then
			print("NPC reached")
		end
	end)
end

animationTrack:Play()

moveToDesignatedPart()
1 Like

its because MoveTo has a 8 second timeout, i would recommend using the code roblox has attached here Humanoid | Documentation - Roblox Creator Hub

3 Likes

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