Why can't I assign custom brick color via code?

When I use the following 2 colors the brick I assign the colors to end up looking exactly the same. Instead of taking the RGB values I’m trying to use the brick just selects the closest roblox color. (At least I think that’s what is happening.)

local TileColor1 = BrickColor.new(0,0.5,0)
local TileColor2 = BrickColor.new(0,0.45,0)

WHY do these appear the same and how can I fix it?

You know you can just do:

tile.color = color3.new(Color vector 3)

Which will change the color, and also If you want to do it your way u have to do

Enum.BrickColor.new(whatever)

Or something like that.

There’s a difference between BrickColor and Color. BrickColor takes in strings such as "Red", "Blue". Color takes in Color3 RGB coordinates. You can set the Color3 of a part from RGB using:
Color3.fromRGB(value, value, value) and the BrickColor like this:
BrickColor.new("Colour name").

1 Like

Isn’t brickcolor an enum?


You can also set it as a string value.

I can’t assign a color3 to a part

Yes you can…

im doing it right now

part.Color = Color3.new(1, 1, 0)

And it works just fine, must be something else

Ahhh gotcha I thought brickcolor was the only property for changing its color

1 Like

Ya brick color is an enum so you need to do Enum.BrickColor.New(and your stuff)

So both works, you can learn more about enums here Enums | Roblox Creator Documentation

Apologies if I was wrong about using strings for setting the BrickColor. I rarely use BrickColor.

1 Like

No worries I didn’t even read your post right lol I was erroneously using BrickColor when I should have just been using part.Color

Well, you can use both BrickColor and Color. BrickColor is easier so you don’t have to set the coordinates (by that I mean RGB values).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.