Issue with MovetoFinished

For some reason The NPC Won’t reach the finish before changing direction after using the Roblox MovetoFinished Function

I want to make it so it touches the Block before changing direction, It works normally if the distance isn’t too far, but if the part is far and then you try it, it won’t reach it and will change even before.

The script should auto touch the brick then change, But its like its ignoring it.

Heres the Code:

local char = script.Parent
local humanoid = char.Humanoid

local pointA = script.Parent.Destinations.PointA
local pointB = script.Parent.Destinations.PointB
local pointC = script.Parent.Destinations.PointC
local pointD = script.Parent.Destinations.PointD

local nextDestinationObject = pointA

while wait(time) do
	if nextDestinationObject == pointA then
		nextDestinationObject = pointB
	elseif nextDestinationObject == pointB then
		nextDestinationObject = pointC
	elseif nextDestinationObject == pointC then
		nextDestinationObject = pointD
	elseif nextDestinationObject == pointD then
		nextDestinationObject = pointA

In the documentation for this function it gives the reason for the error

The reach goal state of a humanoid will timeout after 8 seconds if it doesn’t reach its goal. This is done so that NPCs won’t get stuck waiting for Humanoid.MoveToFinished to fire. If you don’t want this to happen, you should repeatedly call MoveTo so that the timeout will keep resetting.


I’m pretty confused on how to set it up on the actual portion of it tho, Or rather get it to continue I mean. Inserting that code and even connecting it still disconnects before reaching it.

It’s going to be easiest to use connections.

local character = script.Parent
local humanoid = character.Humanoid

local targets = {

local currentTarget = 1

while wait(7) do

    currentTarget = (currentTarget + 1) % #targets + 1  --Resets the target count after it has reached all targets
    humanoid:MoveTo(targets[currentTarget]) --So it doesn't wait for the 7 second loop to finish before starting to move again

And I wasn’t able to test this, so hopefully there are no errors.

So after trying multiple attempts and even doing a print on the MovetoFinished, Still ignoring it which is wild.