Tracking down some performance issues with a resource that's causing more hitch warnings as we hit higher player counts. The profiler consistently points to one of my polling threads.
The loop structure looks like this:
CreateThread(function()
while true do
for _, playerId in ipairs(GetPlayers()) do
refreshPlayerZone(playerId)
end
Wait(0)
end
end)I can see it's scanning every player every frame, and most iterations aren't actually detecting zone changes - the function runs but doesn't do much. The Wait(0) is there but it's still creating pressure as player count increases.
Wondering if I should look at caching player positions and only refreshing when they move significantly, or if there's a better event-driven approach I'm missing for zone tracking.
SpeedyGonzales · 28/08/2026
Sign in to reply.