Why my character does not fully walk to the position?

I want my character to move to the given position.

The issue is that he walks like 20 studs then he stops.

Here’s the script:

wait(2)

local Character = game.Players.LocalPlayer.Character
local Humanoid = Character.Humanoid

Humanoid:MoveTo(workspace.GOPART.Position)

He stops in the middle:

1 Like

Humanoid:MoveTo will time out after 8 seconds:

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.

If you want it to move continuously, then you would have to run it again. You could try doing this:

local Character = game.Players.LocalPlayer.Character
local Humanoid = Character.Humanoid

while wait(1) do--loop every 1 second to prevent lag
    if Character.PrimaryPart.Position.Y = workspace.GOPART.Position.Y then break end
    --check if character has reached the end goal
    Humanoid:MoveTo(workspace.GOPART.Position)
end

On the reference page, there’s another solution you could look at.

3 Likes