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

Help with BrickColor math.random?

Asked by
FiredDusk 1466 Moderation Voter
7 years ago

Not working

Colors = {"Pearl", "Toothpaste"}
game.Workspace.aaa.BrickColor = BrickColor.new(math.random(1, #Colors))

1 answer

Log in to vote
1
Answered by 7 years ago

Why does it not work?

You are setting the color of the brick to the value 1 to 2. It works fine, it's just that you're not actually using tables correctly. Everything works fine though.


How do you fix it?

When using a table, you try to address a value inside like this Table[1]. Table being the table, and the number next to it being which value in the table to choose.


Final Product

Colors = {"Pearl", "Toothpaste"}
game.Workspace.aaa.BrickColor = BrickColor.new(Colors[math.random(1, #Colors)]) --Very small change. Added: "Colors[...]"


Hope it helps!

Ad

Answer this question