Pathfinding problem

Hi, I was just wondering if anyone has the same problem or if there’s a fix to this. So i have made the most simple script of having a dummy move in a straight line to A point. It works for about 5 seconds and then the dummy stops no where near the actual point. I was just wondering how to fix this so the dummy actually travels to the point and touching it without stopping.

Thanks, btw here’s the script and yes i did rename the dummy to titan;
image

The function probably timed out. This is because :MoveTo times out after eight seconds. The following script is from the DevHub and it bypasses the time out

https://developer.roblox.com/en-us/api-reference/function/Humanoid/MoveTo

local function moveTo(humanoid, targetPoint, andThen)
	local targetReached = false
 
	-- listen for the humanoid reaching its target
	local connection
	connection = humanoid.MoveToFinished:Connect(function(reached)
		targetReached = true
		connection:Disconnect()
		connection = nil
		if andThen then
			andThen()
		end
	end)
 
	-- start walking
	humanoid:MoveTo(targetPoint)
 
	-- execute on a new thread so as to not yield function
	spawn(function()
		while not targetReached do
			-- does the humanoid still exist?
			if not (humanoid and humanoid.Parent) then
				break
			end
			-- has the target changed?
			if humanoid.WalkToPoint ~= targetPoint then
				break
			end
			-- refresh the timeout
			humanoid:MoveTo(targetPoint)
			wait(6)
		end
		
		-- disconnect the connection if it is still connected
		if connection then
			connection:Disconnect()
			connection = nil
		end
	end)
end

MoveTo has a timeout of 8 seconds and you wan wait on MoveToFinished to repeat the MoveTo.

e.g.

local finished = false

while not finished do
	humanoid:MoveTo(point)
	finished = humanoid.MoveToFinished:Wait()
end

-- reached goal

note
The second argument of MoveTo is often overlooked but can be very useful.

Ok nice thanks guys ive got it working :+1: