Zone+ v1 (deprecated) | Retrieving players within an area/zone

Amazinngggg!!! Super useful for me, thank you!!


Impressive. This might be a new way to create hitboxes but I guess I have to try it out for myself.

1 Like

I’m really confused about the return value of :getPlayers. I printed the key and value of the table returned, and I expected 1 and my username (concatenating instance results in instance name), however I got two values, which resulted in an error in my code?

Can this be elaborated on?

1 Like

When I enable the EventsExample script in the example place, it just keeps printing “Player Entered zone: SafeZone” when I am in the Zone in a loop and then prints nothing when I leave the zone. Is this meant to happen?

1 Like

Hello HD Team,

Good job! Should I keep an eye on the git repo for updates, or do you also regularly update the asset so that I can simply require it?

Thanks and best regards

1 Like

The function may return only a true, but not a false. This leads to an error in my use case.

My Use Case
print("Is in safezone? " .. tostring(newZone:getPlayer(player)))

Your Function

function Zone:getPlayer(player)
	local char = player.Character
	local hrp = char and char:FindFirstChild("HumanoidRootPart")
	if hrp then
		local origin = hrp.Position +, 4, 0)
		local lookDirection = origin +, -1, 0)
		local ray =, (lookDirection - origin).unit * (self.RegionHeight))
		local groupPart = workspace:FindPartOnRayWithWhitelist(ray, self.GroupParts)
		if groupPart then
			return true

The fix is quite simple, just insert a return false in the last line.

1 Like

@Abbaok_origin For the time being, I recommend using the repository to get the most up-to-date code as that’s actively maintained. Down the line, I’m looking to automatically update the module with the repository’s code, so you’re more than welcome to do so without issue then. I’ll post a follow-up message here once that’s ready.

Added, thanks for the suggestion

1 Like

Hello Forever,

I really like this module and have now integrated it into my simulator to create safezones and a zone where bossfights can take place. I also want to drop gems in certain areas and it would be nice to have a function to get a random vec3 point in a zone. Even if the zone consists of several different, unconnected parts. I’m going to solve this issue differently for now, but maybe this would be a feature for future functions of your module.


Hello Forever,

I have another suggestion for improving your module. I have areas in my future simulator which the players have to unlock. I have created large >local< parts around these areas (by local cloning of already existing invisible “server” parts).I think this os more convenient than collision group. Hackers could simply delete these local parts and have access to the actually locked areas. At the same time I have created these barriers on the server as transparent “server parts”. These are a zone where your event zone.playerAdded listens to. It would be great if you could add an event which is triggered as soon as a player is completely in a zone. I was planning to kill hackers who delete the local parts and go into the zone. Unfortunately, PlayerAdded is already triggered when you touch the outer skin of the zone. This also kills all players who don’t hack and just collide with the outer skin as intended.

Greetings and good work so far!

1 Like

Hi Abbaok, is this something you’re unable to achieve by creating a secondary zone of your smaller desired area, then listening for playerAdded with this?

Hello Forever,

I had the same idea at first. I’m glad you also had the same idea. I don’t find it elegant in code to do this myself. Currently I do it, but that would be a feature you could include if you want to. All you have to do is clone zone parts and scale them down by X% and then you have to listen to the playerAdded, which triggers the new event playerEnteredCompletlyZone (or something like that) in the Parent Zone.


1 Like

This is literally the smartest method I’ve ever seen, I’ve been roughly trying to find some methods to check if a player is in a certain zone without making too many checks and without checking it on the client, your post saved my entire developer career!

1 Like

This doesn’t appear to work with a single part. Is there a way to fix this?

A quick test on single blocks and cylinders appears to work. Are you able to provide more details on reproducing the bug?

I was referring to boundaries. I’m working on a king of the hill system right now and I thought this would’ve been useful for what I was trying to accomplish. Still though, I figured out how to detect players entering and leaving the Hill thanks to your module script.

So thank you! Though, I recommend adding support for boundary type zones!

Edit: Example of what I was trying to achieve:

1 Like

This makes sense now, thanks for clarifying that. It currently fires a ray from the HRP’s position, as apposed to above the region itself. To include your method, I’ll look at firing from that position + the regions height, while extending the raycasting. I’m planning to update the module in the upcoming weeks so will hopefully have it implemented then!


@Abbaok_origin I’ve added in a Zone:getRandomPoint() which returns a random balanced CFrame within the zone. The zone achieves this by creating ‘clusters’ and setting up ‘weights’ based upon a clusters volume. I’ve decided not to introduce an ‘inner boundary’ method as this would require duplicating a lot of methods and properties. I recommend setting up a secondary zone to achieve your desired effect:

I’ve also setup a ‘Coin Spwner’ example:

You’re now welcome to require the MainModule for automatic updates.

@TheRings0fSaturn I’ve modified the core code so you can achieve this effect. The default additionalHeight is now 0, so you don’t even have to specify this parameter when constructing future zones:

I’ve also introduced a ZoneService for easy management of zones between modules and scripts.

You can find more info and these examples here.

Thanks both for your suggestions!


what are the advantages of using region3 are events inefficnet or something?

Feel free to check out the ‘Theory’ section at the top of the post for an explanation on why it uses regions and raycasting.

Events can be as intensive (precise) or light as you decide. The playerAdded and playerRemoving events require :getPlayers() to be called at frequent intervals, or :initLoop() once (which calls this repeatedly). The docs explain this further here:

1 Like

I think I have a problem for this, the problem is if the player leaves the region3 his vote is not stored but using .Touched events like in my voting system this isn’t a problem. For example player A steps on pad then he goes to padb then he decides to go away his vote doesnt store. Is there a way to eliminate this so I can start using the region3 method. Currently I use .Touched for my voting module with for i,v in pairs

Edit: Unless if your doing a while true do loop with region3, but isn’t that more performance heavy then events?

Also for voting pad’s there aren’t really complex shapes so in my case which one would you choose, for voting system and can you also explain the above to