Trying to get used to tables, and this won't work.
color = {"Bright red","Bright green","Bright blue"} rand = math.random(1,#color) for i=1,3 do script.Parent.BrickColor = BrickColor.new(color[rand]) wait(1) end
The brick starts out as black and changes to one of the colors and stops. No error in output, and I've tested multiple times. It should be changing colors 3 times, and it can't be changing to the same color 3 times in a row because I've tested it over 10 times and it always stays one color.
color = {"Bright red","Bright green","Bright blue"} for i=1,3 do rand = math.random(1,#color) script.Parent.BrickColor = BrickColor.new(color[rand]) wait(1) end
You would have to declare the rand variable in the loop as you declare it as a random number outside the loop meaning once that loop starts it's using that same random number it picked at the start and not changing it every time it loops.
-- You wont need the table with this script, but if you want it, I'm sure this script is off-topic --color = {"Bright red","Bright green","Bright blue"} rand = math.random (1,3) scriptname = Script --Insert script name here for error message (not important) if rand = 1 then script.Parent.BrickColor = BrickColor.new ("Bright red") else if rand = 2 then script.Parent.BrickColor = BrickColor.new ("Bright green") else if rand = 3 then script.Parent.BrickColor = BrickColor.new ("Bright blue") else print ("Error: Random number was not found. This script is now prepared to be deleted!") print (scriptname.."is containing this error. Please go there as soon as possible") end end end