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

How can I use these variables to make the block switch through colors? (I think it's pretty basic)

Asked by 3 years ago
Edited 3 years ago

I am trying to make a part change between 9 colors. I will post my script below, I still need to use them to make the brick randomize through the colors that I put. I put the start of my script, but I am a new scripter and am not sure how to randomize them. Could anyone help?

local color1 = BrickColor.new("Institutional white")
local color2 = BrickColor.new("Pink")
local color3 = BrickColor.new("Royal purple")
local color4 = BrickColor.new("Really red")
local color5 = BrickColor.new("Bright yellow")
local color6 = BrickColor.new("Bright green")
local color7 = BrickColor.new("Pink")
local color8 = BrickColor.new("Neon orange")
local color9 = BrickColor.new("Bright blue")
local color9 = BrickColor.new("Black")

while true do
 script.Parent.BrickColor = ??
wait(2.5)
end

Thank you in advance! -HoneyBee

1 answer

Log in to vote
0
Answered by 3 years ago

ez pz

local colors = {
color1 = BrickColor.new("Institutional white"),
color2 = BrickColor.new("Pink"),
color3 = BrickColor.new("Royal purple"),
color4 = BrickColor.new("Really red"),
color5 = BrickColor.new("Bright yellow"),
color6 = BrickColor.new("Bright green"),
color7 = BrickColor.new("Pink"),
color8 = BrickColor.new("Neon orange"),
color9 = BrickColor.new("Bright blue"),
color10 = BrickColor.new("Black")
}

while true do
 script.Parent.BrickColor = colors["color"..math.random(1, 10)]
wait(2.5)
end

u make it a table and then i get a random number between 1 - 10 and choose that

0
Thank you so much, this really helped! H0ney_Beeee 8 — 3y
Ad

Answer this question