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

Hi, this should be fixed now in the latest release!

2 Likes

Does this work with streaming enabled on?

Yep, as long as you’re waiting for the parts before constructing the zones(s) you should be perfectly fine!

local modelOfParts = workspace:WaitForChild("ZoneGroup")
local zone = Zone.new(modelOfParts)

Is there any easy way to allow humanoid dummies for the player entered/exited events or should I just use partentered

I may explore events such as .humanoidEntered, .humanoidExited, etc in the future, although for the time being you’ll have to use .partEntered and .partExited events.

1 Like

trying to use for loops with the zone on player enter but they don’t appear to work. Initially I thought there were mistakes with my for loop but I’ve fixed them but I realized they don’t even pass through the for loop to begin with. Does this module just completely ignore them?

edit: fixed

you may notice unnecessary variable like playertargetfar, i thought for some reason the return wasn’t working but turns out the for loop is complete invisible.

When you say it’s not passing through the loops, is zone1.playerEntered still firing at all or not? (i.e. is ‘entering printed’)?

yea, entering and inside are printing, none of the i’s print

In theory with myself testing, it should print entering, all i’s and then the last elseif’s i and return.

ZonePlus simply provides the events, the functions you connect will work like any other roblox connection.

It’s worth noting that if your #Queue is less your start vale (i.e. 2) then nothing will print within the loop. You can learn more about loops here: Introduction to Scripting | Roblox Creator Documentation

1 Like

you’re right, when I test print my dictionary I get 0 for some reason

local Queue = {
	
	CP1Occupant = "",
	CP2Occupant = "",
	CP3Occupant = "",
	CP4Occupant = "",
	CP5Occupant = "",
	CP6Occupant = "",
	CP7Occupant = "",
	CP8Occupant = "",
	CP9Occupant = ""
	
	
}

#Queue should be == 9 but its not, looks like Ill have to manually enter

You can only call the length function (aka #) on an array (i.e. a table with incrementing integers as keys).

You need to use a for pairs loop for a dictionary. I recommend #help-and-feedback:scripting-support for further help on that.

1 Like

How can I use this to make a part not able to leave the zone?

If the part’s anchored, you can zone:findPart to check if it’s within the zone, e.g.:

game:GetService("RunService").Heartbeat:Connect(function()
    local isWithinZone = zone:findPart(basePart)
    if isWithinZone then
        -- Move part
    else
        -- Don't move part
    end
end)

Thanks! I am making a build mode with a freecam and I want to make it so the camera doesn’t leave the plot.

how can i make partentered/partexited work with anchored parts? i need this for my tower defense game.

ZonePlus doesn’t support anchored parts for non-players at this stage in time. It’s something we may explore for the future.

okay, but i have one more question, does playerentered/playerexited work with npcs?

Not at this stage either, that’s something we’ll likely explore for the future:

okay, thanks anyway.
30 ch ars

Wow this is insane! Thanks a lot!!!