Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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:

while true do
wait(.001)
script.Parent.BrickColor = BrickColor:Random()
end

1 comment

0

Are you asking for them to change into the same random colors? All in sync?

1 answer

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.

local Parts = game.Workspace:GetChildren() --You can change this.

while wait(.001) do --Way much better.
for i,v in pairs(Parts) do --What you want to use
if v:IsA("BasePart") then --Check if it's any type of part
v.BrickColor = BrickColor.Random() --Change the color
end
end
end

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!

This discussion is preserved as it was. New answers, comments, and votes are closed.