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?
✓ ANSWER ACCEPTED
What is the easiest way to choose random values?
1 answer
✓ Accepted answer
Do
colors = {color1, color2, color3}
chosencolor = colors[math.random(1, #colors)]
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
could you explain what you did there?
Oh my bad... I meant math.random
ok, explain plz?
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
ah, ok a table