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

I was also wondering this, I do not think so but I hope there is a way.

OH I actually ended up testing it for myself and yes it does! The zone can be moved at runtime.

Hey, I have a zone made of an array consisting of baseparts. Problem is, I keep getting a exhausted execution time error when I try to get a random point.

Is this normal?

EDIT: My bad, I had a framework which destroyed the parts with no collisions on.

Zone not working sometimes when I clone it from ServerStorage to workspace. It works 50/50 and sometimes not working for no reason. No errors in output. It create zone but playerEntered event not working.

Not sure that’s how you’re supposed to be doing it, wait for it to be in workspace first and then zone it.

1 Like

Anyone know a solution for this ?
Zone detection only works for the developer of the game. Never detects any other player.

local zone = Zone.new(game.workspace.Part)
zone.playerEntered:Connect(function(pl) --Even works only for the owner / developer of the game. Or for only me. It doesn't work on any other player.
end)

Lets say this is in a Local script. zone.playerEntered fires only on this account and not any other accounts / players.

That’s cause it’s in a Local script.

1 Like

Again.

local zone = Zone.new(game.workspace.Part)
zone.playerEntered:Connect(function(pl) --Even works only for the owner / developer of the game. Or for only me. It doesn't work on any other player.
end)

Thats a local script. If I play the game from roblox on account “ShokuTakahashi”. the playerEvent will fire and work fine. But if i login and play the game from a different account named for example “Eric”. It never fires. No matter if its local or server script.

try adding a print

This module will work in server/client.

I did. It does nothing.

local zone = Zone.new(game.workspace.Part)
zone.playerEntered:Connect(function(pl) --Even works only for the owner / developer of the game. Or for only me. It doesn't work on any other player.
print("Hello")
end)

prints nothing on other accounts.
Prints hello on ShokuTakahashi account. Which is the owner of the game.

Ik but it works differently on the client and server.

I think its something about the experience it self but Idk what its. This is the test that I’ve done.

I created another experience to test in it. With 2 accounts as well. Creator and normal player.

In original game. The script prints only if you play with the creator’s account. Prints nothing on normal player.

In the test game. Script prints perfectly on both accounts.

This is the script. Local script located inside StarterPlayerScripts.

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

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

zone.playerExited:Connect(function(player)
	print(("%s exited the zone!"):format(player.Name))
end)

provide a test file.

can say it works for earlier module version as I use it in my game(s) and it functions as intended (server&client), not going out of my way to test it without a file

1 Like

I 've found the issue. It was a function I had that removes player’s bundles with HumandDescription.

1 Like

Does anybody know why trackItem doesn’t work after resetting? This code is in a server script

local zone_Module = require(game:GetService("ServerScriptService"):WaitForChild("External_Modules"):WaitForChild("Zone"))

local function GetTouchingParts(part, doAttack_F, TypeOfAttack, char, localLightsaber, swingSounds, animator, Damage, Hitbox_Module, player, trueOrFalse)

	local hitBoxZone = zone_Module.new(part)
	for _,v in pairs(workspace.Player_Hitboxes:GetChildren()) do
		hitBoxZone:trackItem(v)	
	end
	hitBoxZone.itemEntered:Connect(function(getHurtBox)
		if getHurtBox:IsDescendantOf(workspace.Player_Hitboxes) then
			if getHurtBox.PlayerOf.Value ~= localPlayer then
				if TypeOfAttack == "Normal" then
					doAttack_F(part)
				else
					doAttack_F(TypeOfAttack, character, localLightsaber, swingSounds, animator, Damage, Hitbox_Module, player, trueOrFalse, part)
				end
			end
		end
	end)
end

I mean… how you can use zonecontroller.getGroup() properly?

Not sure if anybody will find this useful, however I edited the “LightingZone” script in the StarterPlayerScripts to allow you to use the Module with Atmosphere!

I’m not a scripter, and really only have the most basic of understandings, but if anybody wanted it, here you go:

local Zone = require(game:GetService("ReplicatedStorage").Zone)
local lightingAreas = workspace.LightingAreas
local lighting = game.Lighting.Atmosphere
local tweenService = game:GetService("TweenService")

-- This is our default lighting
local defaultLighting = {
	Density = 0,
	Offset = 0,
	Color = Color3.fromRGB(0,0,0),
	Decay = Color3.fromRGB(0,0,0),
	Glare = 0,
	Haze = 0,
}

--
lightingAreas:WaitForChild("Green", math.huge)

task.wait()
--

for _, container in pairs(lightingAreas:GetChildren()) do
	
	-- Construct the lighting zones and bind them to the same group to ensure that the localPlayer only enters one zone at a time
	local zone = Zone.new(container)
	zone:bindToGroup("EnterOnlyOneZoneAtATime")
	
	-- This is our zone lighting
	local zoneLighting = {
		Density = 0.423,
		Offset = 0.254,
		Color = Color3.fromRGB(126,126,126),
		Decay = Color3.fromRGB(0,33,179),
		Glare = 0.56,
		Haze = 3.1,
	}
	
	-- This is called when the localPlayer enters the zone
	zone.localPlayerEntered:Connect(function()
		tweenService:Create(lighting, TweenInfo.new(0.5), zoneLighting):Play()
	end)
	
	-- This is called when the localPlayer exits the zone
	zone.localPlayerExited:Connect(function()
		tweenService:Create(lighting, TweenInfo.new(0.5), defaultLighting):Play()
	end)
end

Change in use

I’m sure there’s a better way I could have done this, however, simply changing this code is about the extent to my scripting knowledge.

Thank you so much for providing the community this Module ForeverHD!

2 Likes

Hi guys, I wonder if there is any way to make an “Event” (For example, changing the atmosphere), to players that ARE already inside a zone? Like, the guys are playing and are in the zone, something random happens with the atmosphere and the people inside this zone are infected with it.

This is posted above:


Merc
LordMercProgrammer

Lord_BradyRocks

Nov '22

zone:findPlayer() is what you need.

1 Reply

Reply

Lord_BradyRocksGame Designer

LordMerc

Nov '22

What is there are 2 zones they are in, meaning there is an overlapping zones and they could be in 2 at the same time? Does zone:findPlayer() return multiple zones?

I cannot rem if I ever got it to work tho…
But if you do, when the event happens, you could loop through the players in the game and see if they are in the zone… and or you could be building a table when they enter and exit and then just read the table when the event happens

If you get it working, can you send me a msg with how you did it?

thanks

1 Like