How would i reduce pathfinding lag?

Hello Everyone!

Recently, I have been playing around with PathfindingService

But there’s one issue I keep running into: lag. Would anyone know how to reduce or fix this lag?

1 Like

Cache and limit path calculations.

1 Like

I would politely disagree with

and refer to what I said here

:+1:

Edit: If you did all of that and still have a problem then you can private message me the script and I’ll take a look into it for you and see if I can reduce the lag

1 Like

No, hes right, caching and limiting path calculations is the best way to go about optimizing pathfinding,… I dont see how adding parts to each NPC model would improve?

2 Likes

pathfinding service is decently optimized and generally you shouldn’t have issues, however without knowing how you’re utilizing it, we can’t even dream of finding out what’s actually causing the issue

if we had even the slightest bit of information regarding your usage, it would help people find problems.

the only issue I really can think of is, if you’re using it for something like a zombie and you’re recalculating the path like every frame or so, that would be very expensive, and you’d want to consider reducing how often to maybe once or twice a second instead

1 Like