NPC not moving until player gets close

I’ve recently been playing around with pathfinding for NPC’s, and everything works perfectly fine besides for one issue. The NPC won’t start moving until I get close to it.

Here’s a video of what I mean:

And here’s the script behind it: (Note this is in a local script in starter player)

local PFS = game:GetService("PathfindingService")
local Bob = workspace.Bob

while true do
	local TargetRoom = workspace.Map.Rooms["Room" .. math.random(1,9)]
	
	local Path = PFS:CreatePath({
		AgentRadius = 3
	})
	
	local S, E = pcall(function()
		Path:ComputeAsync(Bob.PrimaryPart.Position, TargetRoom.Boundries.Area.Position)
	end)
	
	for i, v in pairs(Path:GetWaypoints()) do
		Bob.Humanoid:MoveTo(v.Position)
		Bob.Humanoid.MoveToFinished:Wait()
	end	
end

Oddly enough it seems that the distance that triggers the NPC’s movement increases over time. Also, if you chase Bob around the map enough, it’ll eventually start working as intended.

I’m pretty new to pathfinding service so I could very well be doing something wrong, I just don’t no what that is. Any help is appreciated.

Have you checked network ownership of the NPC? It really seems like it doesn’t want to move unless you are close despite you not coding such feature, which means it might be a problem in physics.

2 Likes

Yeah setting network ownership to me seemed to fix things, thanks for the fast solution lol.

1 Like