Hello! im trying to get this system to turn the bgcolor of the template to green if the value == 1. But it wont work! please help there are no errors
local ZoneWalls = workspace:WaitForChild("Areas"):GetChildren()
local Player = game:GetService("Players").LocalPlayer
local PlayersAreas = Player:WaitForChild("Areas"):GetChildren()
task.wait(1)
for _, area in PlayersAreas do
local Template = script._Template:Clone()
Template.Name = area.Name
Template.ZoneName.Text = area.Name
Template.Parent = script.Parent:WaitForChild("Container")
if area:IsA("BoolValue") then
if area.Value == 1 then
Template.BackgroundColor = Color3.fromRGB(85,255,0)
end
end
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
Is this script set to run continuously to check if players are in the PlayersAreas? As it is it only runs once.
I don’t see a function to perform this check if players have left or entered the area.
A while true do loop could work, but it takes more work for the engine to keep checking that.
local ZoneWalls = workspace:WaitForChild("Areas"):GetChildren()
local Player = game:GetService("Players").LocalPlayer
local PlayersAreas = Player:WaitForChild("Areas"):GetChildren()
task.wait(1)
for _, area in PlayersAreas do
local Template = script._Template:Clone()
Template.Name = area.Name
Template.ZoneName.Text = area.Name
Template.Parent = script.Parent:WaitForChild("Container")
if area:IsA("BoolValue") then
if area.Value == true then
Template.BackgroundColor = Color3.fromRGB(85,255,0)
end
end
end