ZonePlus v3.2.0 | Construct dynamic zones and effectively determine players and parts within their boundaries

Is there a way of retrieving the name of the zone entered? I’d like to use it for music zones in my game. Great module btw!

3 Likes

Nice job, this is easier to use than ZonePlus v1 and looks better

2 Likes

You can find an in-depth breakdown of how v2 zones work at the Method page.

It sounds as if you’re using partEntered when you likely instead want to use playerEntered. Player-detection utilises only region and raycast checking; it doesn’t use .Touched connections.

For v2, zones act as a collective therefore a lot of the time zones aren’t performing the region/raycast checks, it’s the players themselves. Because of this it’s impossible to check for zones that have parts outside of workspace.

Zones are fully compatible with both R6 and R15. If you’re experiencing issues feel free to file a bug report and we can take a look.

4 Likes

For ease of use we no longer force users to name their zones although it should be easy-as setting a name property when the zone is constructed then checking for this later on:

local zone = Zone.new()
zone.name = "SoundZoneForest"
zone.playerEntered:Connect(function(player)
    print(("player '%s' entered zone '%s'!"):format(player.Name, zone.name))
end)
7 Likes

Oh I mean, I have many parts in the folder and each of them has a name based on “their” music, however I can’t find any way of getting the part name in the API so I directly asked you if it’s possible. Sorry for not explaining correctly.

1 Like

When you say folder do you mean the group folder containing the baseparts that construct the zone? You may be looking for the zone.groupParts property which returns an array of all group baseparts that make-up the zone.

Alternatively, do you want to retrieve the name of the individual music part the player is touching? If so, it sounds like you’d be better off constructing a zone for each individual part (the group parameter can now take individual parts in addition to models, folders, etc).

4 Likes

Alright I’ll be sure to try that, thanks!

Hey, could you provide any benchmarks if you have ran any, to validate the efficiency of this module statistically? I’m unsure how fast this module would be precisely, especially when handling servers with 300+ (possibly up to 700) active players.

Also, will you consider switching to @pobammer’s Janitor module? it is much more performant than Maid and is cleaner overall.

1 Like

funny enough i have a version of this i made like friday that uses janitor

2 Likes

sounds like ATLA, good work lol

1 Like

The zone detection methodology varies quite significantly depending upon different factors, such as the events you use, total volume of zones, total volume of characters in a server, etc, therefore you can’t really give a precise benchmark for the module as a whole.

If you’d like to run a rough benchmark then I’d recommend opting for the most common player-detection method of checking each player, which involves constructing a RotatedRegion3 of character size (typically 4x2x6), using all zone group parts in the game as the whitelist, then calling that every accuracy interval (which is typically ‘High’) for how many players you wish to test in the benchmark.

Likely not for ZonePlus as the performance gains are completely negligible; maybe for future projects with its greater feature set

4 Likes

Great project!

Only thing i think is missing is a better tutorial on everything, a lot of people might be new to programming or so, then maybe having more detailed explanations would be better.

4 Likes

Is there any way to just check for HRP instead of the entire player for playerExited?

2 Likes

I’m having some trouble here. Not sure if I’m doing this incorrectly but the player exit zone signal will fire even if I’m inside the zone. Maybe I’m misinterpreting the function of this resource. Not sure but, any help would be greatly appreciated.

Screenshots and a Video

This whole model is what I’m using for the zone.

“In” - Outputs whenever a player enters the zone, which would be whenever a player enters a facility.
“Out” - Outputers whenever a player exits the zone, which would be whenever a player leaves the facility.

However, the exit signal fires EVEN if the player is in the zone. Help would be greatly appreciated.

Oh and a screenshot of the code if you need it. Cause you know, I could be typing all of this for one dumb small mistake lol.

2 Likes

Would this be the entire HRP or just its central position, and what benefits would this provide to you?

2 Likes

Zone parts have to encapsulate the entire area of where you want players to be detected. I’d recommend using 2 rectangular parts to cover your whole building, making these parts invisible, anchored and uncancolidable, then only using these parts as the Zone group parts.

4 Likes

Central position, and to fix the player being able to stand outside the zone with just a fraction of their arm in the zone and still be considered inside the zone.

1 Like

This is something we’ve been considering, likely by introducing a bool or enum property to chose between whole body and just the HRPs centre.

If set to ‘centre pos’, this likely would have to be for both playerEntered and playerExited (instead of just playerExited). Would this be fine?

2 Likes

To be entirely specific, I would like playerExited be center position and playerEntered be the whole body, but center position for both would be fine as a toggle.

1 Like

Sure thing, we’ve opened up a ticket and I’ll aim to complete this during some spare time over the next week:

3 Likes