Custom MoveTo() timeout?

The default timeout for MoveTo() for humanoids is 8 seconds. I want it to be considerably shorter (like 2 seconds). This is so my humanoids don’t get stuck for long periods of time.

Is this possible? I know you can make MoveTo() with no timeout, but I’m not sure about a shorter one.

1 Like

Using the MoveTo with a shorter timeout should be as simple as forcing the humanoid not to move after however many seconds, with a unique id to keep from forcing it on a different function call:

local humanoid = --humanoid

local MoveId = 0
local function MoveToWithTimeOut(vector3,timeout)
	MoveId = (MoveId + 1)%1000
	local fnMoveId = MoveId

	humanoid:MoveTo(vector3)

	coroutine.wrap(function()
		wait(timeout)
		if fnMoveId == MoveId then 
			humanoid:Move(Vector3.new())
		end
	end)()
end

Note: I have no idea how this will interact with the humanoid.MoveToFinished event.

5 Likes