My color changing script works but for other colors it turns white

So here is my script.

And when I touch it I get more cash.


so the grey dark one is just my part to know what is the number for a specific color

But when I step on it, it turns to white

Tho I don’t get it because when I use other colors like red it works

2 Likes

If I understood you right, the problem is with different colorized bricks other than white?

1 Like

Yes, but when I want the part to turn to “Dark stone grey” it just changes to white

You can make it so whenever the brick is touched by a player, it’d change its color to that color, it should work fine

Another tip:
Instead of : PLAYER.leaderstats.money.Value = …
You could do :
PLAYER.leaderstats.Money.Value += YOUR_AMOUNT

That’s not the problem…The problem is when I want to change the color of a part if won’t work and will just turn to white

Oh! I now see that!
You are using BrickColor.
You need to use the color Name for that.

YOUR_BRICK.BrickColor = BrickColor.new(“ColorName”)

1 Like

I don’t quite get that :sweat_smile: (can you please give an example?)

You could convert these 2 if you wanted

IT WORKS!! Thank you so much :smiley:

1 Like

Replace the line in that code where u change the color,with this :
YOUR_BRICK.BrickColor = BrickColor.new("“ColoeName”)

It’d automatically open u a list of colors inside of these ()

No problem! Make sure to mark it as a solution:)

In case you wanted to go the RGB route as well instead of actually picking one (which I don’t see why you would, but just for future knowledge) you could do something like the following as well:

p.BrickColor = BrickColor.new(0.7, 0.7, 0.7)

The issue here was because BrickColor.new when working with numbers rather than color only accepts values which are decimals between 0 - 1

2 Likes

Thank you! I will surely keep this in mind :))

1 Like

You could get the color3 of a BrickColor by doing something like this:

Part.Color =BrickColor.New(“Bright red”).Color

1 Like