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

@ForeverHD Do you think it would be possible to get rid of most dependencies in the future? I think it would be beneficial for most of us, thank you :)!

By dependencies are you referring to these?

image

You wouldn’t want to remove these as they’re essential to the running of ZonePlus. ZoneController for instance handles the spatial-checking logic while Janitor helps with the tracking and cleaning of objects.

2 Likes

Okay I understand you, but would it be possible to give us option to place the modules elsewhere? For example by referencing them with Object Values?

What’s your use case for this?

You can quickly modify the location of dependencies by searching script. within the Zone and ZoneController modules and modifying the 5 lines at the top:

2 Likes

I know but doing it each time you update it is kinda “time consuming” :D.
Would it be possible if you can add something like this to the original code?

local Signal = if script.Parent:FindFirstChild("Reference_Signal") then require(script.Parent:FindFirstChild("Reference_Signal").Value) else require(script.Parent.Signal)

Or I can probably just use :FindFirstChild("...",true) instead, thanks for the replying to me tho :)!

I could certainly add a variable for script.Parent to help speed this up. For your very specific use-case it wouldn’t make sense to bloat the module for something which can be modified in a few seconds.

4 Likes

I’m having an issue with a zone. Does it fire partExited if a part inside gets destroyed? I couldn’t find any examples or replies on this.

Yes, even if the part is destroyed or teleported it will still fire the exited signal :+1:

2 Likes

Thanks for the reply, but it didn’t end up firing. I got around it by tracking the part when it enters, then using the itemExited event to see when it exited.

Good spot, just tested now and it doesn’t appear to be functioning for the part events. You’re right in using the player or item events partially instead for the time being which do detect exited as intended. I’ve opened up a ticket for that here:

2 Likes

How do I check if a zone exists?

What do you mean exactly by that? Like if it’s already defined or…?

How can i make in each zone appear something different in a gui
this is what happen to me
when i enter a zone it appears me in the gui but when i go to the other zone it doesnt.
my code:

local Zone = require(game:GetService("ReplicatedStorage").Zone)
local Test1 = workspace.RepublicaMexicanaColliders.Yucatan
local test1 = Zone.new(Test1)

local Test2 = workspace.RepublicaMexicanaColliders.Quintanaroo
local test2 = Zone.new(Test2)

test1.playerEntered:Connect(function(player)
    player.PlayerGui.EstadoDisplay.Frame.Textura.Estado.Text = ("name:".."Test1")
    player.PlayerGui.EstadoDisplay.Frame.Textura.Capital.Text = ("name:".."Test1")
    wait(0.5)
end)

test1.playerExited:Connect(function(player)
    player.PlayerGui.EstadoDisplay.Frame.Textura.Estado.Text = "you are not in a place"
    player.PlayerGui.EstadoDisplay.Frame.Textura.Capital.Text = "you are not in a place"
    wait(0.5)
end)


test2.playerEntered:Connect(function(player)
    player.PlayerGui.EstadoDisplay.Frame.Textura.Estado.Text = ("name:".."Test2")
    player.PlayerGui.EstadoDisplay.Frame.Textura.Capital.Text = ("name:".."Test2")
    wait(0.5)
end)

test2.playerExited:Connect(function(player)
    player.PlayerGui.EstadoDisplay.Frame.Textura.Estado.Text = "you are not in a place"
    player.PlayerGui.EstadoDisplay.Frame.Textura.Capital.Text = "you are not in a place"
    wait(0.5)
end)



(RobloxStudioBeta_YjJnadfYww)

Not defined, I want to find if there is any existing zones.

image

What are you referencing zonecontroller as…?

How would I print the zone name that the player is in?

local Zone = require(game:GetService("ReplicatedStorage").Zone)
local container = workspace.SafeZoneGroup
local zone = Zone.new(container)


zone.playerEntered:Connect(function(player)
	print(("player '%s' entered zone '%s'!"):format(player.Name, zone.name))
end)

zone.playerExited:Connect(function(player)
	print(("player '%s' entered zone '%s'!"):format(player.Name, zone.name))
end)

Simply define whatever name you like:

zone.name = "AVeryCoolZone"

For your code that looks like:

local Zone = require(game:GetService("ReplicatedStorage").Zone)
local container = workspace.SafeZoneGroup
local zone = Zone.new(container)
zone.name = "AVeryCoolName"


zone.playerEntered:Connect(function(player)
	print(("player '%s' entered zone '%s'!"):format(player.Name, zone.name))
end)

zone.playerExited:Connect(function(player)
	print(("player '%s' entered zone '%s'!"):format(player.Name, zone.name))
end)

ok, but what if I have more than one safezone like below?
image

The code would still be the same as what he just posted.

1 Like