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

How Can I Have A Group Of Objects Flash Random Colors?

Asked by
jacobwow 140
10 years ago

I build a maze and need each block in the model to flash a random color. I can make a script to make one part flash but not all the objects in a model. This is the script to make one part flash:

1while true do
2wait(.001)
3script.Parent.BrickColor = BrickColor:Random()
4end
0
Are you asking for them to change into the same random colors? All in sync? tanzane 100 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

You would use, for i,v in pairs() do. You can see the example below if you would like to know how you would use it. I will also include a link to the roblox wiki about it.

1local Parts = game.Workspace:GetChildren() --You can change this.
2 
3while wait(.001) do --Way much better.
4for i,v in pairs(Parts) do --What you want to use
5if v:IsA("BasePart") then --Check if it's any type of part
6v.BrickColor = BrickColor.Random() --Change the color
7end
8end
9end

Basic function pairs

http://wiki.roblox.com/index.php?title=Function_dump/Basic_functions#pairs

If this is what you wanted then accept it as the answer!

Ad

Answer this question