I can't get this Simple script to work

For the last 30 minutes I have been trying to randomly change the color of a part every one second. All it does is glow, and fade, and not actually changing color. What is wrong???

local colors = {"Hot Pink", "Really Red", "Toothpaste", "New Yeller", "Lime Green"}
local tile = script.Parent

while true do
   local ChosenColor = math.random(1, #colors)
   tile.BrickColor = BrickColor.new(ChosenColor)
   wait(1)
end

This script is a child of a part, please let me know if I made any errors. Finally, there were no errors in output or script analysis.

1 Like

Right now ChosenColor is only equal to a random number from 1 to the number of colors in the table. To reference a color in the table do:

tile.BrickColor = BrickColor.new(colors[ChosenColor])

1 Like

Or you could use BrickColor.Random()

Oh ok, how could I not of known!

Also, for some reason, the part is turning white even though the part brick color is not white and in my table, there is no white

I’m not completely sure, but the colors might be case sensitive. For example, “Hot Pink,” should be “Hot pink.”

1 Like

Yeah… Fixed that, thanks man!

1 Like

Correct, I tested it there.
Hot Pink, Hot Red & Lime Green need to be changed to Hot pink, Hot red & Lime green
d9T6O7I

1 Like