how to convert a color3 into a brickcolor
here is a line that breaks
TeamsService[Team1Name.Value].TeamColor = CourtInformation.ForEasternTeams[Team1Name.Value].Color
i basically want to achieve:
converting color3 into a brickcolor
how to convert a color3 into a brickcolor
here is a line that breaks
TeamsService[Team1Name.Value].TeamColor = CourtInformation.ForEasternTeams[Team1Name.Value].Color
i basically want to achieve:
converting color3 into a brickcolor
Put the Color3 inside the first parameter of BrickColor.new()
Example:
BrickColor.new(Color3.fromRGB(255, 255, 255))
BrickColor.new
constructor has an overload that accepts a Color3.
So just BrickColor.new(CourtInformation.ForEasternTeams[Team1Name.Value].Color)
so this is right?
TeamsService[Team1Name.Value].TeamColor = BrickColor.new(CourtInformation.ForEasternTeams[Team1Name.Value].Color)
TeamsService[Team2Name.Value].TeamColor = BrickColor.new(CourtInformation.ForWesternTeams[Team2Name.Value].Color)
Also, need to mention that if you convert Color3 to BrickColor, it will convert to the nearest BrickColor.
Like: Example that I want to convert a Color3 with the value 126, 255, 10. But on BrickColor there isn’t any color that matches 126, 255, 10. So it will convert to the nearest color that exist on BrickColor (let’s say 125, 255, 10)
Yes, that would be the correct way.
I am aware, that info is included in the screenshot.
ok then how to convert brickcolor into color3
The method we provided is just fine.
local a = BrickColor.new("Really Red")
a.Color
That’s a example, not sure does it still works or not
well i want to change the background so how to do change the background of a text label using color of the team
just do it reverse?
BrickColor’s have a Color
property. So background.BackgroundColor3 = team.TeamColor.Color
Workspace . Part . Brickcolour . Brickcolour . (‘very green’)
local p = Instance.new("Part") -- create a part
p.Anchored = true -- anchored = safe
p.Color = Color3.fromRGB(255, 255, 255) -- your color
wait() -- apply
local brickcolor = p.Brickcolor -- your brick color
p:Destroy() -- remove the part
First, you must change Color of specific part then use his BrickColor propertie.
Copy this code to get brick color.
local part = script.Parent --Choose part Instance you want. You can also create a new part.
part.Color = Color3.fromRGB(192,64,128) --Choose color Instance you want.
local partBrickColor = part.BrickColor --This variable are equal to new BrickColor of this part.
part:Destroy() --Use this line only if you choose to create a new part.
I tested this sript and it worked.