By default, every 0.1 interval, although this behaviour can be customised with setAccuracy:
You can use the itemEntered and itemExited events and zone:trackItem to track seats.
This is a typo, thanks for the feedback! I’ll have this fixed.
For our next update we’ll have zones automatically destroy/cleanup themselves if their container/descendants are completely destroyed, however for the time being you must ensure you’re calling zone:destroy()
Not currently, it’s something we are exploring, although it’s not straightforward unfortunately due to how spatial queries work, and due to the collaborative nature of zones.
For our next update we’ll have zones automatically destroy/cleanup themselves if their container/descendants are completely destroyed, however for the time being you must ensure you’re calling zone:destroy()
We swapped the default behaviour from WholeBody checks to just a Central HRP check. If you’d like to swap back you can do:
zone:setDetection("WholeBody")
This appears to be working fine, you can you provide more info?
I really hope the automatic deletion of zones via the part and such deleting update will come soon. I currently use this with loading in parts and despawning them and the zones stick around because the parts are based on modules so it’s impossible to delete the zones manually.
We’ll likely cluster all the current to-do’s into one large update to save us time, so I imagine not for a while as we work towards releasing further open source projects.
If you add the following code under line 120 of the Zone module this should do the trick:
-- This ensures the zone object is destroyed if its associated container is destroyed
if containerType == "Instance" then
container.AncestryChanged:Connect(function()
if not container:IsDescendantOf(game) then
self:destroy()
end
end)
end
For some odd reason, if the player is killed or resets, if the player touches a zone after it, they don’t detect it.
local Zone = require(game:GetService("ReplicatedStorage").Zone)
local Zones = workspace:WaitForChild("Areas") -- This is a folder
local Shop = Zone.new(Zones.ShopAreas) -- then these are also folders with all of the area parts
local Caves = Zone.new(Zones.CaveAreas)
Shop.playerEntered:Connect(function(player) -- shop connect
print(player.Name.." entered the zone!!")
end)
Shop.playerExited:Connect(function(player) -- shop disconnect
print(player.Name.." exited the zone!!")
end)
Caves.playerEntered:Connect(function(player) -- cave connect
print(player.Name.." entered the zone!!")
end)
Caves.playerExited:Connect(function(player) -- cave disconnect
print(player.Name.." exited the zone!!")
end)
This is for a local area music system, it is a local script inside of the StarterGui
First off, what version of ZonePlus are you using?
Secondly, are you sure you want to be using playerEntered and playerExited instead of localPlayerEntered and localPlayerExited (which check only the client’s character, instead of everyones)?
If the issue persists, can you provide further details such as videos and images of the issue, snapshots of the console, etc.
I tried localPlayerEntered and Exited with no luck, now it errors right after the player dies, and doesn’t work still.
I also lose my leave print.
Code –
local Zone = require(game:GetService("ReplicatedStorage").Zone)
local Zones = workspace:WaitForChild("Areas")
local Shop = Zone.new(Zones.ShopAreas)
local Caves = Zone.new(Zones.CaveAreas)
Shop.localPlayerEntered:Connect(function(player)
print(player.Name.." entered the zone!!")
end)
Shop.localplayerExited:Connect(function(player)
print(player.Name.." exited the zone!!")
end)
Caves.localplayerEntered:Connect(function(player)
print(player.Name.." entered the zone!!")
end)
Caves.localplayerExited:Connect(function(player)
print(player.Name.." exited the zone!!")
end)
If you want i dumped all of the parts into a .rbxl if you want to look at it. LocalAreaMusic.rbxl (69.4 KB)
@ForeverHD Hey, Ben I really love your work. But, I’ve noticed a new problem. It seems like Roblox has released a new property called “CanQuery” and if you turn it off on the part that was used as a container for Zone, it will not work. Could you please update it to output the error when we turn off “CanQuery”?