Why PathFindingService Is Laggy?

Hello. This Issue Happened To Me All The Time When I Wanted To Use PathFindingService. The Issue Is On Roblox Studio When you Run the game on client or server the pathfindingservice is not laggy but in the game that you publish its laggy

Now how it is laggy :
Npc Stop Like About 0.1 Second At Every WayPoint Depending On How Much Your Lagging

Now What Should I Do?

Can you please send the code that you are using, so me and other developers may be able to help you.

The normal pathfinding code that can be found on developer.roblox.com

1 Like

If you are testing it in studio that happens to me too…
But you should test in normal ROBLOX game not in studio .
Studio is just makes hard to test things .
edit : Or it can because of animations…

1 Like

Try setting the network ownership of whatever you’re using the pathfinding service on to the server. What could be causing the “lag” is stutters in it’s replication to the clients.

Yeah I had same issue on my game before its because of the network ownership thing just use this code

npcModel:SetNetworkOwnership()

Models do not have a SetNetworkOwnership function - you’ll have to set it for each part manually.

for _, object in pairs(npcModel:GetChildren()) do 
   if object:IsA("BasePart") then 
      object:SetNetworkOwner()
   end
end
7 Likes