Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I change a brick color to the corresponding team color?

Asked by 6 years ago

The idea is to make the sleeve color of my arms correspond with your team. If you are blue, your sleeves turn blue.Red, sleeves are red. I made a small script which I though would work. Can someone point out what I did wrong and rewrite it for me?

local sleeve = script.Parent
local player = game.Players.LocalPlayer

if player.TeamColor == "Bright blue" then
    sleeve.BrickColor = "Steel Blue"
end

1 answer

Log in to vote
0
Answered by 6 years ago

you're comparing a brickcolor value to a string. lines 4-5.

and do a for loop because the if statements you have only execute once. and is sleeve a basepart?

local players = game:GetService("Players"):GetPlayers()
local s = script.Parent

for _, plr in pairs(players) do
    if plr.TeamColor == BrickColor.new("Bright blue") then
        s.BrickColor = BrickColor.new("Steel blue")
    end
end
0
s.BrickColor = plr.Team.TeamColor BouncingBrenda 44 — 6y
0
Yes, sleeve is a basepart. agentk139 -3 — 6y
Ad

Answer this question