ZonePlus setup w/ a zone store

ZonePlus v3 however comes with a zone store and a way to render all stored zones.
This only works with vectors and cframes. Does not support instances.

Follow what the models name say and then it should all work fine.

You can add more zones by editing the list inside of the ZoneStore module:

return {

   [1] = {
		CFrame.new(188.65, 15.6, 103.8), -- pos
		Vector3.new(58.1, 31.2, 30) -- size
	},
  [2] = {
    --your data here
  },

}

Why not set names for the indexed values?

Saving memory. Its also just easier.

Register script:
Works off the player character

repeat task.wait() until game:IsLoaded() == true and game:GetService("Players").LocalPlayer.Character ~= nil

local zonefolder = game:GetService("Workspace"):WaitForChild("zones")
local zones = require(game:GetService("ReplicatedStorage"):WaitForChild("Zone"))
local zoneStore = require(game:GetService("ReplicatedStorage"):WaitForChild("ZoneStorage"))
local player = game:GetService("Players").LocalPlayer -- parse to track.

for i, v in ipairs(zoneStore) do
	--loop through zonestore and get the cframe and vector3 for each zone.
	local zone = zones.fromRegion(v[1], v[2])
	zone:relocate()
				
	local entered = zone.itemEntered:Connect(function(item)
		print(("%s entered the zone!"):format(item.Name))
	end)

	local exited = zone.itemExited:Connect(function(item)
		print(("%s exited the zone!"):format(item.Name))
	end)

	zone:trackItem(player.Character) -- track the player
end

If you really wanted too you could change the handling however for me personally it doesn’t mean much to me for my project.


Download:
zone but with a module.rbxm (34.8 KB)

1 Like