Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What is the easiest way to choose random values?

I need to randomly select a color for a brick, but not any color, it has to be one of a specific list of colors. Let's say there are five colors ("color1", "color2" ...), what is the easiest way to pick one of them?

1 answer

✓ Accepted answer

Do

colors = {color1, color2, color3}

chosencolor = colors[math.random(1, #colors)]

5 comments

0

could you explain what you did there?

0

Oh my bad... I meant math.random

0

ok, explain plz?

0

My code above states the colors that should be chosen from and then chosencolor value is set to a randomized selection of a color inside the table

0

ah, ok a table

This discussion is preserved as it was. New answers, comments, and votes are closed.