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

Efficient way of getting all colours?

Asked by
Ryzox 220 Moderation Voter
9 years ago

Is there a more efficient way of getting all colours in ROBLOX rather than manually adding them? I have my own admin tablets I've been developing over the past week and I'm thinking of when I make them play a song, the tabs will go disco until the song stops, I know how to make it stop and start it's just the part about, is there a method like BrickColor:GetColors() so I don't have to manually add every colour? I know that isn't right but it's just the only way I can explain it.

0
To actually answer you, there is no such method. You could do a Color3 bruteforce loop, but it'd be easier to just do it manually. Or make a ModuleScript that return a table of all 64 BrickColors. adark 5487 — 9y

1 answer

Log in to vote
0
Answered by
Redbullusa 1580 Moderation Voter
9 years ago

Assuming you only want random colors, you could use

[ Part ].BrickColor = BrickColor.Random()

Or

r = math.random()
g = math.random()
b = math.random()

[ Part ].BrickColor = BrickColor.new(r, g, b)

This constructor accepts a set of Color3 values. Color3 values accept values between 0 and 1. Conveniently, math.random() returns a floating point between 0 and 1.

Constructors

As adark said, you can't "get" all of the colors available on Roblox. What you can do is think all of the colors are already in a table. Then, you can use the two options that I mentioned with constructors.

Or you can, going back to what adark said, create a table manually.

Ad

Answer this question