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