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:

while true do
wait(.001)
script.Parent.BrickColor = BrickColor:Random()
end
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.

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!

Ad

Answer this question