Help with .MoveToFinished:Wait()

So, I have figured out from https://developer.roblox.com/en-us/api-reference/function/Humanoid/MoveTo that humanoids will stop moving when it doesnt reach its destination in time using :MoveTo(). It says to repeatedly run the :MoveTo() script to keep reseting the timer. Problem is, I dont know how to do this with my script. Any help?

	for waypoint=1, #w:GetChildren()  do
		mob.movingTo.Value = waypoint
		hum:MoveTo(w[waypoint].Position)
		hum.MoveToFinished:Wait()
	end

It’s been a while since I’ve done anything like this, but you might be able to use a repeat statement inside of the for loop.

1 Like

so should i do

repeat
--stuff
until hum.MoveToFinished:Wait()
1 Like

It works! thx

limit

Shouldn’t MoveToFinished be working at all?

Put a print as soon as the event gets fired, to check if it actually works. If if does, then the code inside has an issue.

local rig = workspace.Rig --example character

--move the rig first, then:

rig.Humanoid.MoveToFinished:Connect(function()
    print("stopped")
end)

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