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

oh sorry!! but I had to use lighting zone that from playground file but idk why it not work with current version that not need to be in folder…

Change your zone module to the latest one and show your script/location after migrating and see if it works.

i’m using latest version but I can try show it tomorrow it late in here for me.

I have an issue using it with streaming enabled, I am currently using ZonePlus for lighting, but it does not work when I have streaming enabled, when it is disabled it works fine, but when it is enabled it does not. I have tried adding WaitForChild() but it doesn’t seem to work too. Any solution for this?

Also, here is the script I’m using for lighting:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Zone = require(ReplicatedStorage.Modules.Zone)
local ZoneController = require(ReplicatedStorage.Modules.Zone.ZoneController)
local Lighting = game:GetService("Lighting")

for i, v in pairs(game.Workspace:WaitForChild("InteriorLights"):GetChildren()) do
	local AllParts = Zone.new(v)

	AllParts:bindToGroup("AmbientAreas")

	AllParts.localPlayerEntered:Connect(function()
		Lighting.Ambient = Color3.fromRGB(255, 255, 255)
	end)

	AllParts.localPlayerExited:Connect(function()
		Lighting.Ambient = Color3.fromRGB(70, 70, 70)
	end)
end
1 Like

Hey, I never used an open source project like this and is intrested is this future proof?

Is this recommended for melee hitboxes?

1 Like

If you track too much items (14 for me) :trackItems() it will completely break and getItems will throw error attempt to index nil with CFrame
getParts() will also return empty array
and events like itemEntered and itemExited wont fire

absolutely essential to complex games, thank you all for the time you put into this free resource!

Starting to get this as well. It can be buggy and inconsistent.

2 Likes

Update: Don’t create a zone for the same part in two separate scripts. It’ll bug out. That was the issue with me, but I will see if more items will cause issues too.

2 Likes

I am using zone+ to be incorporated with a trunk system and other gui based store locations
the issue is

  1. until recently it randomly works and doesn’t for players, i could be playing as player1 and it won’t run past the initializing constants and for player2 it works

  2. i can’t get the zone’s to update if a new car is added to the folder

i tried doing trunkzone:_update(), etc and childadded functions and nothing works

local function findTrunks(carsFolder)
	for _, trunk in ipairs(carsFolder:GetChildren()) do

		if trunk.Name == "Trunk" then

			local trunkzone = Zone.new(trunk)

			trunkzone.localPlayerEntered:Connect(function()
				
				-- my function here
			end)
			trunkzone.localPlayerExited:Connect(function()
				-- exit function here
			end)
		end
		findTrunks(trunk)
	end
end
findTrunks(carsFolder)

Will this ever get a Wally integration?

1 Like

The issue was with Streaming Enabled. Despite using :WaitForChild("Water_2") and whatnot, I was having issues.


Edit: nevermind to the nevermind. I’m also using collection service and trying to get zones to work with that. Going one error at a time and working through it.

Edit 2: Collision detection works fine now for me, I got it working.

my old reply

Hi,
I’m using a custom character and trying to implement this module into my game PB & Jay. I’ve read through the documentation, read through this post, and have watched the tutorial in its entirety. I’ve been trying to get this module to work with my custom water part system, but have been unable to detect collisions at all.


Here's the code

----- Zone Module -----
-- https://devforum.roblox.com/t/zoneplus-v320-construct-dynamic-zones-and-effectively-determine-players-and-parts-within-their-boundaries/1017701

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

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

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

Here's a video of collision detection not working


If I need to provide more info, don’t hesitate to ask. I’ll look into the module code and whatnot to try finding a solution, but if you (@ForeverHD) could give me any info, that’d be great.

Thanks,
Reditect

Have you tried setting CanQuery to true because apparently you need CanQuery set to true in order for it to work. (most of the time)

1 Like

Yep.
image

I’ve gotten the collisions to work with ZonePlus, now it’s just my implementation of a swimming system in my custom Animate script that I need to fix.


Update, 8/1/2023:

Been testing for more than an hour sifting through the code of the module itself. My issue was that it was checking for a “Head” but my custom character’s head’s name was “head”. Not capitalized. Be sure you change what the code is looking for or you change the head name to “Head”.

I am facing a similar issue, but based on my research, it seems that whenever a part is destroyed within a zone, the zonevolumecustom changes to 256, whereas previously it was in the millions. This behavior seems suspicious.

the Error:



2 Likes

I have a question about ZoneEvents. Is it possible to disconnect these events whenever we no longer need them?

So if I’m running a script similar to this one:

local item = character:FindFirstChild("HumanoidRootPart")
zone:onItemEnter(item, function()
    print("The item has entered the zone!"))
end)

But it tracks the humanoid root part of every player in the game, and then a player decides to leave the game, will it be possible to disconnect the event that is tracking it? Or is this done automatically?

Anyone know how to make a Zone created using fromRegion visible?

I’m not seeing a way to do this through the API. I’m going to assume there is no need to, as using onItemEnter isn’t necessarily creating a new event, but adding the given item to a list. When the item is destroyed, it’s automatically removed from the list of items needing to be checked in the zone.

I could be wrong on this tho.

Any help would be appreciated.