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

Requiring via ID is discouraged, it yields your script, you lose intelissense (afaik), and it’s just not a good thing.

Roblox has started to warn devs when a module is required by ID too. I believe this is a way to discourage it a bit as well.

Him doing that would also mean that he wouldn’t be able to be agressive with API changes that break backwards compatibility without creating another model.

It would also mean that he could change something and it would break your game accidentally.

IIRC, TopBar v1 had ID requiring support, but that was dropped in V2, and I can understand why, since it’s a bad practice. I believe he wouldn’t go back and start supporting it.

Well, don’t worry about that. Update if anything breaks, or periodically with all the libraries you use. I’m an update freak but yeah I don’t see it being much of an issue.

Edit: you can also have notifications on GitHub releases on his repo, so you’ll know if anything important gets fixed

1 Like

I have some problems with localPlayerEntered event it doesn’t fire.

local zonemod = require(game.ReplicatedStorage.Zone)
local Zone = zonemod.new(workspace.TESTZONE)

Zone.localPlayerEntered:Connect(function()
	print("hitt")
end)

1 Like

That’s an amazing module
Its really useful and reliable

1 Like

Show that you’re doing it in a local script, and show the properties of the brick inside. You need CanQuery true

2 Likes

is deleting the parts of a zone safe on memory or do I have to make the zone nil too?
I can still print the actual zone after deleting its parts and even disconnecting it

Is there a way I can dynamically remove and add parts from a zone? For example, I have a table of parts that will constantly have values removed/added from them:

local parts = {workspace.Part1} -- workspace.Part1 will successfully print "part detected"
local zone = zones.new(parts)
zone.localPlayerEntered:Connect(function()
    print('"part detected"')
end)
foo.Event:Connect(function(bar)
    table.insert(parts, bar) -- `bar` will not print out "part detected"
end)

EDIT 1
So in order for the module to consider newly inserted parts in the table, I had to call zone:_update() immediately after inserting/removing a part. This is clearly a hacky method the API doesn’t have this method, but it will do for now.

local parts = {workspace.Part1} -- workspace.Part1 will successfully print "part detected"
local zone = zones.new(parts)
zone.localPlayerEntered:Connect(function()
    print('"part detected"')
end)
foo.Event:Connect(function(bar)
    table.insert(parts, bar) -- `bar` will now print out "part detected"! yay!
    zone:_update()
end)

Hello, is there any way I can make this module work with collision groups. I have a collision group with pets that do not collide with each other, and I want to know if any points enter the zone. If there is no way for the module to do that, are there any other methods to enable me to do so? Thank you!

1 Like

Hey quick question:
Does the zone automatically get removed when the container is destroyed? Or do I have to manually destroy it myself?

1 Like

In pairs does not seem to work for me. Been messing with it for a few hours, still can’t figure it out… In the video below, notice keep an eye out for where it says “Entered” & “left” zone so you can see which zones are calculated.

Here is my code:

local LocationCD = false

function ReloadLocationCD()
	LocationCD = true
	wait(0.3)
	LocationCD = false
end


for _, group in pairs(game.Workspace.LocationParts:GetChildren()) do
	local zone = ZoneM.new(group)
	zone.localPlayerEntered:Connect(function()
		warn("entered a zone")
		if LocationCD == false then
			script.Parent.Thought.Thought.Event:Fire(".. " .. group.Name .. " ..")
			AtmosphereModule:ChangeLocation(group.Name)
			ReloadLocationCD()
		end
	end)
	
	zone.localPlayerExited:Connect(function()
		warn("left a zone")
		if LocationCD == false then
			AtmosphereModule:ChangeLocation("global")
			ReloadLocationCD()
		end
	end)
	
end

Can you maybe add the group.Name to the warn, so we can see better what’s happening and where?

been a long time user of this module, its just great! Recently trying to use this in an obby game and I have notice that zones dont fire event unless the HumanoidRootPart of the character enters the zone.

I did a quick test where only the feet of the character touch the zone, and the events dont fire. I seem to remember this module was able to detect partial parts of a players character, am I remembering things wrong?

ALSO: The API section of the docs site is empty, theres nothing in there. Introduction - ZonePlus

1 Like

Yo I got a question. Is there a way to get the specific part collided with to fire zone.playerEntered? For example, lets say I have parts inside of a folder, which don’t combine to create a new region but they are spread out across an area, but they all have the same function, just runs the code in different areas. How can I get that specific part the player ran into? Great module btw I use it a lot <3

This ability hasn’t been added yet, has it? I see you closed the issue on github but there aren’t any updates.
I have a problem like OP’s where using a workspace part breaks some things. I’ve read that maybe I can use replicated storage zones if I put them within WorldModels? I suppose I’ll experiment with that solution if this isn’t a native ability yet.

Is there any way to detect if a player is already within a zone?
e.g. dialogue boxes starting when you’re within a radius, and exiting when you’re out of a radius.

local isWithinZoneBool = zone:findLocalPlayer()
2 Likes

Can you use the same “container” part for multiple zones? I can’t find anything in the documentation about it but I believe doing that is what’s been making my code break.

If I’m blind and it clearly states that somewhere please don’t be mad at me.

Nice module, useful for a heckton of things outside of hitboxes.

1 Like

Great module. But does it have spherical detection?

1 Like

By the looks of it, it appears to even have cone shaped zones so I’m sure it will also have spheres :+1:

1 Like

localPlayerEntered doesnt seem to work when you reset while in the part?