Fastest way to check which object has the most player inside of it

I’m trying to make a cam system that uses whatever camera corresponds to the “zone” (a part that has an object value in it that leads to a certain camera) with the most players inside (or closest) to it. I was wondering the quickest (most efficient) way to do this.

If the area is a circle/cylinder/sphere, you can run a simple within-radius check on each player by comparing their displacement from the camera
Otherwise, use spatial queries such as workspace:GetPartBoundsInBox for a “box” area or workspace:GetPartsInPart for more complicated objects

2 Likes