I'm having trouble setting it when a plr joins the game, a brick changes color based on his leaderstat brick value.
Please help
local
colors={
[1] = "Terra Cotta",
[2] = "Black"
}
-----------------------------------------------------
game.Players.PlayerAdded:connect(function(player)
-----------------------------------------------------
local val = player:WaitForChild("Leaderstats").Brick.Value
local dd = workspace.Brick
----------------------------------------------------------
if val >= 1 then
wait(1)
----------------------------------------------------------
if val >= #colors then
dd.BrickColor = colors[#colors]
else
dd.BrickColor = colors[val]
end
end
end)

1 comment
you forgot to add BrickColor.new(colors[#colors]) or BrickColor.new(colors[val])