Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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

2 comments

0

s.BrickColor = plr.Team.TeamColor

0

Yes, sleeve is a basepart.

This discussion is preserved as it was. New answers, comments, and votes are closed.