Figure out what zone a player is in

Hello all.
In my new game I have a system to detect what zone a player is in (for purposes like cheat detection or music changes).
Currently, each zone is assigned a giant detailed union and the zone val is changed depending on what union the player is touching.
What better method is there for this?? My current method is very bad for performance and often has weird hitboxes.

Thanks

1 Like

i use the ZonePlus module by ForeverHD

works on both client and server fyi

1 Like

Hi, really the best method is just using parts instead of unions, although this heavily depends on the shapes of your zones.

Do let me know if this helps at all :slight_smile:

just create invisible parts in each zone then uh when a player touches it their " zone val " changes, i dont think u need detailed unions

The zones are detailed. It needs detailed unions

I think even under the situation where the zones are insanely detailed you would probably still have better results and more exact hotboxes just using parts. Unless of course, your zones are for some reason the shape of the Mandelbrot set, then you have simultaneously achieved the impossible (in terms of Roblox) and have gone far outside the bounds of any help you could find here, let us hope you have not made your zones Mandelbrot set shaped. :grin:

In all seriousness though, if you are looking for better performance and more accurate hotboxes then I would recommend using parts instead of unions, even under a situation where you have to add five extra parts for each zone. Five extra parts will most likely run better than the calculations that Roblox has to do for each union.

if the zones are packed together then ye u need unions, if they are far apart u could just use boxes