Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Problem with BrickColor.new() returning a different color than expected?

Asked by 6 years ago

so whenever i use BrickColor.new() it returns a different color than expected sometimes, why? here is part of a script:

script.Parent.BrickColor = BrickColor.new(255, 0, 0) -- turns the color red
wait(2)
script.Parent.BrickColor = BrickColor.new(31, 128, 29) -- turns it to forest green

when it changes it to the green, it makes it white ._.

1
Use Color3.fromRGB Griffi0n 315 — 6y

1 answer

Log in to vote
3
Answered by
Griffi0n 315 Moderation Voter
6 years ago

Brick color expects argument 1 as a string. Instead use Color3.fromRGB

script.Parent.Color = Color3.fromRGB(255, 0, 0)
wait(2)
script.Parent.Color = Color3.fromRGB(31, 128, 29)
0
Thanks!!! cruizer_snowman 117 — 6y
0
BrickColor accepts numbers aswell and it's not the issue. You simply can't set a color of a part to one not defined in brickcolors. If you use the Color property or number arguments of BrickColor.new, it will just set to the closest BrickColor. Amiaa16 3227 — 6y
0
well yeah but im not gonna explain that in depth Griffi0n 315 — 6y
Ad

Answer this question