|
| 19 Nov 2012 05:09 PM |
b = game.Workspace.Jumps.RotatedBrick for i = 1, 86 do wait() b.Color = Color3.new(math.random(),math.random(),math.random()) end
When the game runs, the script is supposed to go into the workspace into a model and recolor 86 different bricks (all with the same names).
Am I not being specific enough with my code, or is there something my script lacks..? |
|
|
| Report Abuse |
|
|
|
| 19 Nov 2012 05:12 PM |
| Also, if I lack of anything in this script, will someone explain what it is and why it's needed if it isn't too much? Thank you. |
|
|
| Report Abuse |
|
|
crouton04
|
  |
| Joined: 07 Jul 2010 |
| Total Posts: 4459 |
|
|
| 19 Nov 2012 05:29 PM |
| b.BrickColor = BrickColor.new(math.random(), math.random(), math.random()) |
|
|
| Report Abuse |
|
|
crouton04
|
  |
| Joined: 07 Jul 2010 |
| Total Posts: 4459 |
|
| |
|
|
| 19 Nov 2012 05:48 PM |
Thanks, but I forgot to mention that it only colors one brick 86 times.. Do I rename them all..? |
|
|
| Report Abuse |
|
|
crouton04
|
  |
| Joined: 07 Jul 2010 |
| Total Posts: 4459 |
|
|
| 19 Nov 2012 05:52 PM |
No, put the things in a model then do this..
while Wait() do -- you can remove this, this makes it repeat color change.. bricks = game.Workspace.Model:GetChildren() for i=1,#bricks do if bricks[i].ClassName == "Part" then bricks.BrickColor = BrickColor.new(math.random(), math.random(), math.random()) end end end end |
|
|
| Report Abuse |
|
|
|
| 20 Nov 2012 01:24 AM |
| Is the third line basically saying 'for __ number of bricks in 'model', run the script the same number of times' ? (By the way, sorry for a late reply, had homework.) |
|
|
| Report Abuse |
|
|
awas3
|
  |
| Joined: 24 Oct 2010 |
| Total Posts: 2854 |
|
|
| 20 Nov 2012 06:55 AM |
for i = 1, #bricks do
i is just a variable...
#bricks is the number.
This would print the number of bricks:
p = game.Workspace:GetChildren()
print(#p)
A more advanced way is:
bricks = {}
for _, v in pairs(game.Workspace:GetChildren()) do table.insert(bricks, v) end
print(#bricks)
That would also print the number.
~A3~ |
|
|
| Report Abuse |
|
|