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

How do you use [] with math.random?

Asked by
IcyEvil 260 Moderation Voter
10 years ago

Im scripting something that HAS to be randomly generated in a table But I dont know how to randomly generate it, without using math.random, And I dont know how to use math.random, Any Examples???

EDIT 1

I want a Brick To change Colors In a Pattern Like a Wave But Randomly generated I need to know how to use [] and math.random to generate a random color in a brick.

0
Can you please explain yourself much better? BlueTaslem 18071 — 10y
0
Alright let me fix it IcyEvil 260 — 10y

1 answer

Log in to vote
4
Answered by 10 years ago
Colors = {"Bright blue","Bright red"}

interval = 1

while wait(interval) do
script.Parent.BrickColor = BrickColor.new(Colors[math.random(1,#Colors)])
end

There! Put real colors where the "Colors" table is If you don't want to set it do this:

interval = 1

while wait(interval) do
script.Parent.BrickColor = BrickColor.Random
end
0
Made typo whoops fireboltofdeath 635 — 10y
0
I fixed it! fireboltofdeath 635 — 10y
0
Okay.. Then... fireboltofdeath 635 — 10y
Ad

Answer this question