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

transforming colors to their RGB?

So I have a name gui where the color of the label should be the team color.

here's an example of what I'm trying to do

game.Players[player].Character.Head.BillboardGui.TextLabel.BackgroundColor3 = team.TeamColor

Obviously it doesnt work because teamcolor is a string (Bright Red) but the Color3 needs to be a RGB value, is there a way to transform the string color to its rgb value?

1 answer

✓ Accepted answer

TeamColor is actually a BrickColor, not a string.

Luckily, BrickColor objects have a Color property, which is the RGB representation of the BrickColor!

Just append a .Color after team.TeamColor.

Also, if player is a variable that references the player object itself, don't go back to game.Players to get it – use player directly.

player.Character.Head.BillboardGui.TextLabel.BackgroundColor3 = team.TeamColor.Color

Just as a side note: use :GetService when getting services. This is the canonical way to get services. If for some reason a service is renamed, you won't be able to access it with game.ServiceName.

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