How to cancel :MoveTo()

I am making a npc and when you are in a distance you get followed with magic and stuff. But I wanna do when the player gets to far it stops I know how to do that. But I am using :MoveTo() how do I cancel it?

2 Likes

You can call Move(Vector3 dir) to make it move in a specific direction, so not to a specific point. If you pass Vector3.new(0, 0, 0) to it, the Humanoid will stop moving.

This did not work properly for me - for some reason there are cases where MoveTo makes the character keep running.

I have also tried MoveTo(player.Character.PrimaryPart.Position) and the following without success

player.Character.Humanoid:Move(Vector3.new(0, 0, 0))
player.Character.Humanoid.WalkToPart	= nil
player.Character.Humanoid.WalkToPoint 	= Vector3.new(0, 0, 0)

Also ensured that MoveTo is not called repetitively, another odd thing is that MoveTo does not timeout after 8 seconds when the problem appears.

2 Likes

Try setting the MoveTo position to the position of the HumanoidRootPart.

2 Likes

Try this:

local NPC =
NPC.Humanoid.PlatformStand = true
NPC.Humanoid.WalkToPart = nil
wait()
NPC.Humanoid.PlatformStand = false
4 Likes

This post is from November, I assume OP found a solution

Maybe, but it was better to close this topic with a comment that it solved it.

9 Likes