How to check when moveto is finished?

im trying to check when a :MoveTo is finished, but its not working, how do I fix this?

local humanoid = v:WaitForChild("Humanoid") --parented to character
			humanoid:MoveTo(position) --call MoveTo() on humanoid
			wait()
			local seat = game.Workspace:WaitForChild(v:WaitForChild("SeatPart").Value)

humanoid.MoveToFinished

here this works

Im confused, can you give me an example of how this works?

1 Like

its an event so it will fire when that move to finishes
https://developer.roblox.com/en-us/api-reference/event/Humanoid/MoveToFinished

1 Like

Try this:

	humanoid:MoveTo(position)
	humanoid:MoveTo.MoveToFinished:Wait() -- replaces your wait()
3 Likes

Like @BadDad2004 said take a look at humanoid.MoveToFinished

1 Like

It’s just an event. Here’s an example:

humanoid:MoveTo(Vector3.new(50,0,0))

humanoid.MoveToFinished:Connect(function(reached) -- Here, the parameter Reached is a bool, which indicates whether the Humanoid has reached the position yet.
	print("Player has reached 50, 0, 0")
end)
1 Like

or you could use humanoid.MoveToFinished:Wait() in a function.

1 Like