The zone control script has the function or event whatever its called GetPropertyChangedSignal but the first time when the game starts up freshly it doesn’t change the text of the textlabel when ZoneType value changes.
Zone System Script:
local ZoneOdds = require(game:GetService("ServerStorage"):WaitForChild("ZoneOdds"))
local function ChooseZone()
local totalChance = 0
for Zone,Odds in pairs(ZoneOdds) do
totalChance = totalChance + Odds
end
local roll = math.random() * totalChance
local accumulatedChance = 0
for Zone,Odds in pairs(ZoneOdds) do
accumulatedChance = accumulatedChance + Odds
if roll <= accumulatedChance then
return Zone
end
end
return nil
end
local function SetZonePos()
local xMin = math.min(-93.75,93.75)
local xMax = math.max(-93.75,93.75)
local zMin = math.min(-93.75,93.75)
local zMax = math.max(-93.75,93.75)
return CFrame.new(math.random(xMin,xMax),8,math.random(zMin,zMax))
end
local Zone = game:GetService("ReplicatedStorage"):WaitForChild("Zone")
while true do
local ChosenZone = ChooseZone()
if not workspace:FindFirstChild("Zone") then
Zone.Parent = workspace
end
workspace.Zone.Type.Value = ChosenZone
workspace.Zone:PivotTo(SetZonePos())
for secs = 10,0,-1 do
if math.clamp(secs,41,60) == secs then
workspace.Zone.ZoneInfoUI.Holder.ZoneDuration.TextColor3 = Color3.fromRGB(76, 229, 112)
elseif math.clamp(secs,21,40) == secs then
workspace.Zone.ZoneInfoUI.Holder.ZoneDuration.TextColor3 = Color3.fromRGB(255, 149, 1)
elseif math.clamp(secs,0,20) == secs then
workspace.Zone.ZoneInfoUI.Holder.ZoneDuration.TextColor3 = Color3.fromRGB(255, 6, 81)
end
workspace.Zone.ZoneInfoUI.Holder.ZoneDuration.Text = tostring(secs)
task.wait(1)
end
end
Zone Control (This is the issue):
local ZoneModule = require(game:GetService("ReplicatedStorage"):WaitForChild("ZoneModule"))
local Container = script.Parent:WaitForChild("Detector")
local ZoneDetector = ZoneModule.new(Container)
local Border = script.Parent:WaitForChild("Border")
local ZoneType = script.Parent:WaitForChild("Type")
local PlayersInZone = {}
local ZoneInfoUI = script.Parent:WaitForChild("ZoneInfoUI")
local ZoneNameDisplay = ZoneInfoUI:WaitForChild("Holder"):WaitForChild("ZoneName")
local ZoneCapacityDisplay = ZoneInfoUI:WaitForChild("Holder"):WaitForChild("ZoneCapacity")
local MaxCapacity = 3
ZoneType:GetPropertyChangedSignal("Value"):Connect(function()
table.clear(PlayersInZone)
ZoneCapacityDisplay.Text = #PlayersInZone .. "/" .. tostring(MaxCapacity)
if ZoneType.Value == "Safe Zone" then
ZoneNameDisplay.Text = ZoneType.Value
ZoneNameDisplay.TextColor3 = Color3.fromRGB(76, 229, 112)
elseif ZoneType.Value == "Heal Zone" then
ZoneNameDisplay.Text = ZoneType.Value
ZoneNameDisplay.TextColor3 = Color3.fromRGB(68, 203, 99)
elseif ZoneType.Value == "2x Damage" then
ZoneNameDisplay.Text = ZoneType.Value
ZoneNameDisplay.TextColor3 = Color3.fromRGB(235, 78, 0)
elseif ZoneType.Value == "4x Damage" then
ZoneNameDisplay.Text = ZoneType.Value
ZoneNameDisplay.TextColor3 = Color3.fromRGB(214, 68, 0)
end
end)
ZoneDetector.playerEntered:Connect(function(plr)
if #PlayersInZone < 3 then
table.insert(PlayersInZone, plr.Name)
ZoneCapacityDisplay.Text = tostring(#PlayersInZone) .. "/" .. tostring(MaxCapacity)
if #PlayersInZone == 3 then
Border.CanCollide = true
end
end
end)
ZoneDetector.playerExited:Connect(function(plr)
table.remove(PlayersInZone, table.find(PlayersInZone, plr.Name))
ZoneCapacityDisplay.Text = tostring(#PlayersInZone) .. "/" .. tostring(MaxCapacity)
if #PlayersInZone < 3 then
if Border.CanCollide == true then
Border.CanCollide = false
end
end
end)