humanoid:MoveTo not running

got a zombie ai and it was wokring find but when i go on one area :MoveTo never runs

video:

code:

for i, v in ipairs(waypoints) do
	local timeout = MoveToWaypoint(humanoid, root, v)
	print(timeout)
	if not timeout then
		-- got stuck
		humanoid.Jump = true
		WalkRandom(zombie)
		break
	end
	
	if zombie.target ~= nil then
		FindPath(zombie)
		break
	end
end

function MoveToWaypoint(humanoid, root, waypoint)
	if waypoint.Action == Enum.PathWaypointAction.Jump then
		humanoid.Jump = true
	end
	
	if waypoint.Label == "Jump" then
		humanoid.Jump = true
	end
	
	humanoid:MoveTo(waypoint.Position)

	if waypoint.Action ~= Enum.PathWaypointAction.Custom then
		task.delay(0.5, function()
			if humanoid.WalkToPoint.Y > root.Position.Y then
				humanoid.Jump = true
			end
		end)
	end

	local timeout = true
	if waypoint.Action ~= Enum.PathWaypointAction.Custom then
		timeout = MoveToFinished(humanoid, 1)
	else
		timeout = MoveToFinished(humanoid)
	end
	
	return timeout
end

local function MoveToFinished(hum: Humanoid, timeout: number): boolean
	local event: BindableEvent = Instance.new("BindableEvent")
	local success: boolean = true
	
	if timeout then
		task.delay(timeout, function() 
			success = false 
			event:Fire() 
		end)
	end
	
	task.defer(function() 
		hum.MoveToFinished:Wait() 
		event:Fire() 
	end)
	
	event.Event:Wait()
	event:Destroy()
	return success
end
1 Like

it set up the scripts wrong, fixed it

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