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

Yep that should be fine, they won’t deactivate assuming their body parts are still within the zone.

You can use the partEntered and exited events to achieve this. e.g.

zone.partEntered:Connect(function(part)
    print(("part '%s' entered the zone!"):format(part.Name))
end)

zone.partExited:Connect(function(part)
    print(("part '%s' exited the zone!"):format(part.Name))
end)

Do note, the part events only work for unanchored parts.

1 Like

Thank you! I asked because I am making a cube-activated-button-to-open-door thing and this really helps me, because if I use Touched and TouchEnded, the events will fire multiple times.

But how about if I move with CFrame the Player’s character outside the zone?

That should work fine too :+1:

1 Like

I have a question, if I have a model with a hollow center would ZonePlus take in all of the bounds of the model or just the parts?

It accounts for the parts within, not the boundary of the model.

1 Like

Ok, thanks for the help, and the module is amazing it has helped and made my job a lot easier!

1 Like

Instead of rotatedregion3 couldn’t you use some trig to figure out if the rootpart’s position is inside the rotated zone?

Say you have the red cube as the point and the white cube as the zone
image

Then you rotate the cube and the point around so the cube’s orientation is at 0,0,0

Then it’s easy, you just check if the point > min and point < max of the zone

You can do this method by rotating the point by -zone.Orientation with

I haven’t tested the performance difference but I think it’s fair to say this method is probably faster

Although this will just check if a point is inside a zone and not a cube inside a zone I don’t think it will matter too much

For cuboids this is fine, however without performing additional checks this won’t account for other geometries such as Spheres, Cylinders, etc and those from MeshParts and UnionParts.

As you mentioned as well, that only accounts for a singular point, whereas ZonePlus by default provides whole-body checking. It’s also important to note that player region checks are typically not performed on the zones, they’re instead performed on the characters who then determine the zones they are within.

I haven’t checked if this was a thing coming but if there is a V3 what would it have that would make it better then V2?

I believe there is a bug in Zone+. When I use my character model, it works. When I use someone else character model. It doesn’t work.

How are you applying this other character model? With HumanoidDescriptions? Setting the player.characters parent? Can you provide more reproduction steps.

2 Likes

Using HumanoidDescriptions I am providing this avatar.

A youtuber found the same bug and it takes him multiple times to get the part to work. And I am using zone+ module.

for (const [i, v] of pairs(Rewards.GetChildren())) {
		const Trigger = v.FindFirstChild("Trigger") as BasePart;
		const zone = new Zone(Trigger);
		zone.setAccuracy("Precise");
		if (Trigger) {
			zone.localPlayerEntered.Connect(() => {
				Touched(v.Name);
			});
		} else {
			warn(`"Need a Trigger Part for ${v.Name}`);
		}
	}

(Sorry its in Roblox-TS)

Good shout thanks for the report, I haven’t tested this although I can see a very likely cause.

I’ve opened up a ticket; will aim to have complete for the end of the week:

1 Like

Is there a way to get the zone part that they entered?

You can get a dictionary of all the parts a player is touching is touching with ZoneController.getTouchingZones, e.g:

local touchingZonesArray, touchingPartsDictionary = ZoneController.getTouchingZones(player)
for part, zone in pairs(touchingPartsDictionary) do
	print(("%s is touching part '%s' from zone '%s'"):format(player.Name, part.Name, zone.zoneId))
end

(make sure to be using the latest model)

v2 also enables you to construct zones with a singular BasePart, so you could alternatively do this and listen for the entered and exited events for each individual part instead.

1 Like

This should be fixed now in the latest release:

1 Like

Did you change the ZoneController only or are there other scripts you changed?

The ZoneController and Signal module, you can find these changes here:

Hey! ZonePlus Is A W E S O M E, but! I found a problem, whenever some seat or vehicle seat enters the zone, their CanTouch property Is set to false and because of that, you can’t sit there. It happens when the script inside of the zone has partEntered event. Shown in the video below :smiley:

Good spot, thanks for the report! I’ve opened up a ticket and will aim to have this complete for tomorrow or Friday:

1 Like