Is there a way to give priority to zones? So if its higher, they will be activated before other zone thats at the same area.
You will need to cache the zone and check if the player is in the priority 1 zone before or not.
Hello, what’s the optimal amount of zones recommended for performance? (client) because in my game i wanna have zones for each EggStand, and I was wondering if there is a recommended max limit number for zones.
Since i wanna check if player entered the Stand’s Hitbox then pop ui else pop ui off
It would seem the model on the Roblox website returns a Bad Request.
can’t access the model, it says bad request
Wow, this is amazing! This really helped me out on my first simulator game. Thank you so much
constantly getting errors about calling a nil value
even made a completely fresh game and put in a simple script and still not working
anyone else getting this problem?
hey, so even though im calling the module from a local script, it seems to replicate to the server. is there a way to prevent this?
That’s not even a thing? Show your code and usage.
It’s fine, I ended up just going a different path. Not sure why it was happening, probably something was replicated to the server.
Hi! How would I detect the exact name of the zone part that a player has entered inside a container? For example, I have a container with 10 safezones in it all named safezone1, safezone2, etc. I want “safezone7” to be printed out, but I can’t find any API for that.
Hey, you can get the parts the player is touching with:
local touchingZonesArray, touchingPartsDictionary = ZoneController.getTouchingZones(player)
The parts are within touchingPartsDictionary
.
If you need to listen for players entering/exiting these parts, you would make every part into it’s own zone. Creating more zones adds minimal-to-no additional impact to performance.
Wonderful, thank you for the insight was avoiding the solution you gave because I thought it would impact performance, great to know it doesn’t!
Is it possible to make .itemEntered/.itemExited fire on every part that enters the zone?
I can’t just use the .partEntered/.partExited events because the parts that I am looking for are achored parts that have a Light (any PointLight/SurfaceLight/SpotLight), and I can’t think of a way to reliably add tracking to every part I need.
Edit, some more info:
I’m trying to make road signs glow when you drive close them, currently each sign that is tagged with “retroreflectiveSign” will get a new zone, and in that zone I want to detect each part that enters and check if that part has lights.
for _,o in pairs(CLS:GetTagged('retroreflectiveSign')) do
local newZone = ZONE.fromRegion(o.CFrame, Vector3.new(300,300,256))
-- zone size is mainly for testing, will make a better one later
local coro = nil
newZone.itemEntered:Connect(function(part)
print('part entered')
local pol = part:FindFirstChildOfClass('PointLight')
local sul = part:FindFirstChildOfClass('SurfaceLight')
local spl = part:FindFirstChildOfClass('SpotLight')
if part and (pol or sul or spl) then
print('is light')
coro = coroutine.create(TrackLight)
coroutine.resume(coro, o, part, pol, sul, spl)
end
end)
newZone.itemExited:Connect(function(part)
print('part exited')
local pol = part:FindFirstChildOfClass('PointLight')
local sul = part:FindFirstChildOfClass('SurfaceLight')
local spl = part:FindFirstChildOfClass('SpotLight')
if part and (pol or sul or spl) then
print('was light')
coro.yield()
end
end)
end
Do not use this module. A game I recently released depends on this heavily but it ended up breaking. The code is messy and does not account for errors. I had to fix many issues with it like players not being registered or detected. The regions sometimes failing to calculate causing the zone to break. I suggest to make your own using robloxs new blockcast/shapecast.
:trackItem should help you out here:
If you’re experiencing issues you’re welcome to share reproduction steps - even better submit modifications through Pull Requests via GitHub. This wrapper is actively used throughout many games which haven’t reported issues with player registration.
I know about :trackItem, I’m asking if there’s a way to simply track every item that exists in the workspace. There no good way for me to start tracking what I need to detect because the models that the lights are connected to are constantly being spawned/despawned.
ZonePlus purposely doesn’t track all workspace objects (or provide a way) because this could become expensive for games with lots of instances.
Are you able to use CollectionService to tag all parts that have lights? You could then listen for when a part with lights is added to workspace then track it for all relevant zones.
I could explore making :trackPartsWithTag() a futute update to help with this.
Any plan for new update or maybe rewrite?