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

Figured out why task.delay works. It was delaying it to after p was set to p2 so it deleted the new one and kept the old. Still don’t know how to make a new zone in a disabled script in map cloned.

Yeah I probably had to clarify more.

so basically, I have a tycoon game where I use zones to detect door and garage enters/leaves. (& more)

I have set up everything right and it worked most of the time, only sometimes upon playing the game all zones in the game start to break and for some reason my audios linked to sound groups also get affected by this (they just unlink), I’m not sure how it’s relevant.

I can show you some code but like I said, all zones sometimes work or sometimes none do. I have removed the onEnter(Player) functions and typically put in print statements to detect Enters and Leaves but that leaves me with no outputs, I also use zones for region detections from different scripts and they also do not seem to work when the zones break. It’s all or nothing.

Now I am wondering, is there a cap on how many zones you can use?

self.Zone = ZoneModule.fromRegion(self.Model:FindFirstChildWhichIsA('Attachment', true).WorldCFrame, Vector3.new(15, 15, 15))

self.Zone.playerEntered:Connect(function(Player) onEnter(Player) end)
self.Zone.playerExited:Connect(function(Player) onLeave(Player) end)

(Keep in mind that I’m receiving no errors/warnings from the zone script)

Got it working, had some problems with my metatables, sorry!

Anyway to get around :setaccuracy() changing the accuracy of all zones. This is very annoying and doesn’t allow us to have different zones with different accuracy. I’m guessing I’d have to rewrite the _formHeartbeat function in zonecontroller to make a heartbeat connection for each zone, but I don’t know how performant that would be

The module and the autocomplete just kinda doesn’t work anymore for me. There are no errors and no output when using actual code, such as printing players entering zones.

I used this to create a custom renderer for a procedurally generated world. It’s much more efficient on performance than touch connections. Also the renderer has increased my FPS from 15-25 to 47 low to 60 FPS on a laptop. My experience Writing a Custom Renderer Massive Game Optimization Methods - Resources / Community Resources - Developer Forum | Roblox

Yes the way you would do that is

local enum = require(game:GetService("ReplicatedStorage").Zone.Enum)
local zonearray = Zone.new(container)
zonearray.accuracy=enum.enums.Accuracy.Low

That changes the accuracy of all zones

Roblox autocomplete is just bad, not the module’s fault usually. As for the module not working I have no idea what could cause that, I’ve been using it for the last few months and no problems have come up.

2 Likes

this isn’t working for me. Events never trigger when I walk into the zone.

You should try the template place to understand how it works.

No, the module has perfect autocomplete normally when I use it, I don’t think I’m doing anything wrong it looks the same as how I always used it

Is there a way to use the same container in different zones?

i.e;

local ZoneOne = ZonePlus.new(workspace.Zone)
ZoneOne:bindToGroup("One")
ZoneOne.localPlayerEntered:Connect(function()
	print("Entered zone one!")
end)

local ZoneTwo = ZonePlus.new(workspace.Zone)
ZoneTwo:bindToGroup("Two")
ZoneTwo.localPlayerEntered:Connect(function()
	print("Entered zone two!")
end)

When doing this, only ZoneTwo’s localPlayerEntered event gets called. Binding them to different groups also doesn’t seem to solve the issue.

My use case is that I have one zone that has various mechanism acting on it. For example, ambience and game mechanics.

-- In AmbienceController.lua
Zone.localPlayerEntered:Connect(function()
    game.Lighting.Ambient = Color3.new(0.5, 0.5, 0.5)
    game.Lighting.OutdoorAmbient = Color3.new(0.5, 0.5, 0.5)
end)
-- In MinigameController.lua
Zone.localPlayerEntered:Connect(function()
    startMiniGame()
end)

I do not necessarily want to merge both of these into one script. Apologize if otherwise but the documentation does not seem to explain this.

For now, my temporary solution is to initialize only one zone in a controller and create a getter function ZoneController:GetZoneForArea(area) and act on that instead.

Ideally, being able to bind to different groups to create two different functionalities for the same container would be best, so I do not need to have one system just dedicated to managing ‘zones’.

EDIT: FIXED ALREADY, HAD TO DEAL WITH OVERLAP AND RAYCASTPARAMS


Hello! I’m using this system to make a “zone entering and leaving notification” to a game i’m working on. But i’m having some troubles that the query system is affecting the camera (making it zoom in as it had collision) and blocking shots (as seen in the video below 0:06)

I’m separating each zone with large parts

Is there a way to fix those problems i’m having? (I got zero to none knowledge with query, so i really dont know if there is a method that i could use to avoid those)

Watch Desktop 2024.05.15 - 19.14.52.11 | Streamable (somehow this video isnt embedding so… sorry about that)

1 Like

In my map, there are gonna be big areas and I am gonna be detecting when the player enters a certain area, what would be the best way to do this? I can imagine that having big parts to represent the areas might cause lag

Hello, @ForeverHD!

Trying to run :getRandomPoint on an unanchored part returns a exhaustion timeout request, this was a mistake on my end as the zone was not intended to be unanchored, but I thought it would be best to let you know.

Thanks!

2 Likes

Hey, I know that this is a old topic, but i can’t seen to be found a thing, I want to make custom zones for different ambients, that means like desert zones, ice zones etc, so how can i get the zone part name without being from a variable?

Use the example game. It is uncopylocked and you can look at the code

You would just do:

local Part = game.Workspace:WaitForChild("Part Name Here")

bro, what did i just said? i said without it being from a variable, i want to check which zone name when the player touches the zone

Loop through all zones

It should look something like this:

local ZoneFolder = Put all of the zones in a folder and reference it here
for _,Zone in ZoneFolder do
     Zone.PlayerEntered:Connect(function(plr)
           print(plr.Name.." has entered "..Zone.Name
     end
end