How do I make a dance floor with specific colours? Here's my attempt:
local colours = { "Really blue", "Deep orange", "New Yeller", "Bright green", "Really blue", "Cyan", "Carnation pink", "Eggplant", "White" } local randomColour = math.random(1,#colours) local Parts = game.Workspace.GameParts.unsafeParts:GetChildren() while true do for i,v in pairs(Parts) do if v:IsA("Part") then v.BrickColor = BrickColor.new(colours[randomColour]) end end wait(4) end
Edited mines*
local Parts = game.Workspace.GameParts.unsafeParts:GetChildren() local Colors = { "Really red", "Bright yellow", "Bright blue" } while wait(4) do -- You can also do this for waiting for i,v in pairs(Parts) do if v:IsA("Part") then local Num = math.random(1, #Colors) -- Get a random number between 1 and the number of strings in colors v.BrickColor = BrickColor.new(Colors[Num]) -- So if Num == 2, then it would change to bright yellow end end end
Hope this helps!
Alternatively, you could do this:
local colors = { BrickColor.new("Tawny"), BrickColor.new("Toothpaste"), BrickColor.new("Teal"), BrickColor.new("Terra Cotta"), BrickColor.new("Steel blue"), } local randomcolor = colors[math.random(1,#colors)] local part = game.Workspace.Part part.BrickColor = randomcolor local Parts = game.Workspace.GameParts.unsafeParts:GetChildren() while true do for i,v in pairs(Parts) do if v:IsA("Part") then v.BrickColor = BrickColor.new(colours[randomColour]) end end wait(4) end