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

How do I make a dance floor with specific colours?

Asked by 4 years ago

How do I make a dance floor with specific colours? Here's my attempt:

01local colours = {
02           "Really blue",
03           "Deep orange",
04           "New Yeller",
05           "Bright green",
06           "Really blue",
07           "Cyan",
08           "Carnation pink",
09           "Eggplant",
10           "White"
11       }              
12 
13       local randomColour = math.random(1,#colours)
14       local Parts = game.Workspace.GameParts.unsafeParts:GetChildren()
15 
View all 23 lines...
0
Why not use BrickColor.random Pupppy44 671 — 4y
0
ok ill try and test CHEESEPIZZAPARTYTIME 5 — 4y

2 answers

Log in to vote
0
Answered by
Pupppy44 671 Moderation Voter
4 years ago
Edited 4 years ago

Edited mines*

01local Parts = game.Workspace.GameParts.unsafeParts:GetChildren()
02local Colors = {
03"Really red",
04"Bright yellow",
05"Bright blue"
06}
07 
08while wait(4) do -- You can also do this for waiting
09           for i,v in pairs(Parts) do
10               if v:IsA("Part") then
11        local Num = math.random(1, #Colors) -- Get a random number between 1 and the number of strings in colors
12                   v.BrickColor = BrickColor.new(Colors[Num]) -- So if Num == 2, then it would change to bright yellow
13               end
14           end
15   end

Hope this helps!

0
Yeah but I want to use specific colours, not any random colour TheObviousNinja 19 — 4y
0
I edited mines, you can retry it. Pupppy44 671 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Alternatively, you could do this:

01local colors = {
02    BrickColor.new("Tawny"),
03    BrickColor.new("Toothpaste"),
04    BrickColor.new("Teal"),
05    BrickColor.new("Terra Cotta"),
06    BrickColor.new("Steel blue"),
07}
08 
09local randomcolor = colors[math.random(1,#colors)]
10 
11local part = game.Workspace.Part
12part.BrickColor = randomcolor
13 
14local Parts = game.Workspace.GameParts.unsafeParts:GetChildren()
15 
View all 23 lines...

Answer this question