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

Your LocalScript ‘Controller’ needs to be located within StarterPlayerScripts instead of StarterGui so that it doesn’t reset on spawn:

image

Also make sure to correct localplayerEntered to localPlayerEntered

3 Likes

@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”?

1 Like

Thanks for the suggestion, we’ll introduce a warning for that in the next release:

3 Likes

How can I check if a Humanoid entered the zone? Like not a player, but an NPC?

There is a big issue where ZonePlus stops working and thats if you got around 24 listeners for PlayerExited, PlayerEntered, ItemExited and ItemEntered

So basically this connection won’t work if there are too many connections that listen for any of the things I put above.

local zone = ZONE_MOD.new
zone(WS.Game.DoorZones.DoorRoom1.Hitbox).playerEntered:Connect(function(player)
print(player)
end)
1 Like

Read the documentation man, you’ll find it there:

It’s “partEntered”

1 Like

How would I control the volume of audio?
To make it ease in and ease out when entering and exiting a zone

For some reason, the ambient music doesn’t work for terrain maps?

Your best bet is doing zone:trackItem(NPCHumanoid) then using the itemEntered and itemExited events to listen for changes.

2 Likes

If you have time, can you link me to an uncopylocked place which reproduces this issue. This would be super helpful in exploring it further.

1 Like

You can find an open source example of that at the playground:

3 Likes

Try walking between the rooms and you’ll see some exited or some entered don’t fire,

1 Like

Is this module still usable for new work?

Yep ZonePlus is actively maintained :+1:

You can track its changes and to-do list at the repository:

3 Likes

Hello! So I’m trying to make zones to change the lighting when entered. But when I enter the Zone, nothing happens. I’m probably doing something wrong. here is my code:

It’s a local script.


local ZonePlus = require(game.ReplicatedStorage.Zone)
local Zone = ZonePlus.new(script.Parent)

local LightModes = require(game.ReplicatedStorage.LightModes)

local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()

Zone:bindToGroup("LightingGroup")

Zone.itemEntered:Connect(function()

	LightModes:SetMode("MorningSun")

end)

Zone:track(Char)


Need to be using LocalPlayerEntered
snippet from my work:

local zone = Zone.new(group)
	zone:bindToGroup('SectionZones')
	zone:setDetection("Centre")
	zone.localPlayerExited:Connect(function()
		activeZones = activeZones-1
		print(activeZones)
		if activeZones == 0 then
			changeLighting(Lighting.Outside)
		end
	end)
	zone.localPlayerEntered:Connect(function()
		activeZones = activeZones+1
		if Lighting[group.Name] then
			changeLighting( Lighting[group.Name] )
		end
	end)
3 Likes

Ah thanks. I didn’t realize there was a different event for local scripts. Lol

1 Like

This is so good Roblox should hire you to include it natively into Roblox Studio, very usefull, most likely every game made in Roblox soon or later will need some kind of zone checking making devs most of the times use poorly made checking without proper performance. With your module developers get it for free, with good performance and very easy to use. Congrats on your great work!

1 Like

Did you ever find out what the issue was? Looked at the github and dont see any updates.

This is really awesome. One thing though, I’m creating like a spatial audio type of thing as presented in one of the examples. The problem is that I have some parts inside of the zone that contains SurfaceGUIs with buttons on them. The button events won’t be registered as the zone is in the way.

Trying CanQuery actually works, but then completely disables the zone.
Any recommendations on how to solve this problem?