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

To make this work properlly after the player dies / gear is destroyed do i need to break the connection to the modulescript?

Hey yoshi, you can achieve this two ways:

  1. If you know the zone and want to check a player is within it, do…
local isWithinZoneBool = zone:findPlayer(player)
  1. If you want retrieve an array of all zones the player is within, do…
local ZoneController = require(game.ReplicatedStorage.Zone.ZoneController)
local touchingZonesArray = ZoneController.getTouchingZones(player)

What are you using ZonePlus for within your tool? There may be alternative solutions

im using it in the context of making a more reliable (than touch atleast) system to detect when a skateboard is on a rail or a ledge so it can play the corresponding sound, its in a local script in the board.

rails.localPlayerEntered:Connect(function(player)
	OnRail = true
	FakeRailStart:Play()
	FakeRailLoop:Play()
	Remotes.Sound:FireServer("startrail")
end)
rails.localPlayerExited:Connect(function(player)
	OnRail = false
	FakeRailStart:Stop()
	FakeRailLoop:Stop()
	Remotes.Sound:FireServer("stoprail")
end)

the “FakeRail” stuff is just for the client to hear and the server script deals with the other ones

I love ZonePlus!

Suggestion:

Allow both PascalCase and camelCase so my code doesn’t look weird:

for _, Checkpoints in pairs(Checkpoints:GetChildren()) do
	local CheckpointZone = Zone.new(Checkpoints)
	CheckpointZone.playerEntered:Connect(function(Player) -- This line is odd
		if Checkpoints.Name ~= "EndRace" then
			CheckpointTrue(Checkpoints.Name, Player)
		end
	end)
end

See this response here:

We won’t support PascalCase methods/properties as these don’t conform to the Roblox Lua Formatting Guidelines. You’re welcome to create and maintain your own fork though.

1 Like

Wait, you can’t have 2 zones in the same script? It’s not working for me

You can, I just separate the examples at the playground into separate scripts for organisational purposes. Feel free to share you construction code if you’re still having difficulties.

the shaggy wearing, animation maker and coder is back at it again!
this is a nice api, Congrats!

By alternative solutions do you mean not using zoneplus?

Ive made it work by putting the Zones module in the skateboard, it fixs the issue earlier where when you die it breaks the zones but it only works for 1 person at a time so i want to know if theres a way to make the module script client? not sure if thats possible

If you’d like to utilise ZonePlus on the client you can use the local player events (and simply require the Zone module from a LocalScript):

I was already using the local player events

Quick question

Could I put the part in replicated storage and still use a zone with it and allow it to work? My item interaction system uses a point from the player to the mouse and when something is inside a region but the player isn’t, or they’re dragging something into the region, it kinda glitches a bit due to the mouse not having a direct view of the item in the region, even when the zone part’s transparency is 1 and cancollide is false.

Also adding onto this question:

Is there any way to reference :getParts() parents? The parents of the parts. It seems to return nil when trying to reference their parents.

1 Like

Not currently, although it is something I’d like to support for the next update.

:getParts() simply returns an array of Roblox BasePart instances, so unless your parts have no parent they will function like any other part. Can you share your more details, such as your code, if this is still an issue.

Will you be able to add support to special meshes since using only a part or meshpart will have a limit on the size.

If there’s a method to achieve this then we can certainly explore it although as far as I’m aware it’s impossible to detect the boundaries of special meshes.

What I suggest is letting people choose the part type so it can be more accurate but have the size of the mesh.

What are you trying to achieve that a MeshPart and Zone of size 2048, 2048, 2048 can’t do?

It is just much area for a zone for planetary size.