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

Show code.

Also show code.

More than likely you’re both using this module wrong as I’ve had no issues with either given events.

1 Like

Hi, I am making a safe zone script for a specific team, with ZonePlus, but it doesn’t seem to work. I followed the documentation and tried the scripts in the playground but it doesn’t work

local Target = game:GetService("Workspace"):WaitForChild("Pitch"):WaitForChild("GK")["Space"]
local Zone = require(game:GetService("ServerScriptService"):WaitForChild("Modules")["Zone"])

local Parts = {

	Home = Target:FindFirstChild("Home"),
	Away = Target:FindFirstChild("Away"),
}

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Teams = game:GetService("Teams")
local Players = game:GetService("Players")
local ValuesFolder = ReplicatedStorage:WaitForChild("Values")
local Space = ValuesFolder:WaitForChild("Space")

local SpaceValues = {

	Home = Space:FindFirstChild("Home"),
	Away = Space:FindFirstChild("Away"),
}

local Vector = Vector3.new(167.28, 1.121, -1.362)
local Vector1 = Vector3.new(-161.846, 1.121, -1.362)


local HomeZone = Zone.new(Parts.Home)
local AwayZone = Zone.new(Parts.Away)

HomeZone.playerEntered:Connect(function(player)
	if SpaceValues.Home.Value == true then
		if player.Team == Teams["-Home GK"] then return end
		player.Character:MoveTo(Vector)
	end
end)

AwayZone.playerEntered:Connect(function(player)
	if SpaceValues.Away.Value == true then
		if player.Team == Teams["-Away GK"] then return end
		player.Character:MoveTo(Vector1)
	end
end)

By the way, the Parts are parentered inside a folder, one folder for home and another for away.

image

Have you tried doing a print/warn inside the playerEntered…? Also, is your value actually true?

I set it to true in another server script, and yes I have tried prints and it doesn’t seem to print

So in this case, it wouldn’t print true?

No, I’ve tried multiple things and it still doesn’t print.

Are you able to make a place repo…? I don’t see how your code isn’t working.

I can’t right now, but even using the example scripts in the post doesn’t work for me.

The examples work, it’s fairly obvious you’re missing or doing something wrong which is why a repo is needed.

I found the issue, nothing wrong with the script, I made the part a bit bigger and it worked somehow, maybe it wasn’t detecting the player before idk

Also one more thing, is there a way to check if the player is already in the zone? Because when my space system is enabled, it doesn’t teleport the players in the zone unless they jump, then it teleports them

zone:getPlayers() is the function you need for getting players.

1 Like

if the part of the zone get deleted will the zone connections also get deleted and zone will be destroyed?

I don’t believe so, I just fixed an issue where zones would not be made from previously existing parts (zones) by garbage collecting manually, when game ends, I destroyed all .zones.

I was under the impression that it would garbage collect automatically when the part is destroyed but that wasn’t the case with my issue just now.

setDetection seems to not be working, unless I’m not understanding how it works. I thought WholeBody would make it so playerEntered only fires when the player’s whole body is inside the zone.

I Have a question. So When I use zone.payerEntered, how can I noticed which part(inside container) is triggered by player.

1 Like

How would I get the position of the area a player or part entered the zone?

hello i was wondering how this module works performance wise for lets say for example 1000 regions in a game.

1 Like
zone:setAccuracy()

sets the accuracy for every single zone, is there a workaround? This is very annoying as these zones only need to run per one second, compared to my other zones that need to be precise.

1 Like

Hey Forever, how would i use this to make a part touch another part