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

How would I keep two teams from having the same random teamcolor?

What I'm trying to do is make a new team for every player that enters and have that team's name be the Player's name with a random TeamColor.

I can use BrickColor.Random() to find a random color for the Team, but how do I ensure (and still end up with a new team) that no two teams have the same color?

1 answer

✓ Accepted answer
local color1 = BrickColor.Random() 
Team1.TeamColor = color1

local color2 = BrickColor.Random() 
while color2 == color1 do
color2 =  BrickColor.Random() 
end

Team2.TeamColor = color2

2 comments

0

Will this function no matter how many teams eventually end up in the game?

0

Yes. Just repeat it for all the teams.

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