|
| 30 Dec 2011 06:07 PM |
I know how to script a brick to do something, like change the transparency every 0.5 seconds. But I would like that to happen to 10 more bricks in a model. So I wouldn't have to enable all scripts at once. I have created a script where you put it in the model with the bricks. For example:
Model Script Brick Brick Brick Brick Brick Brick Brick Brick Brick Brick
So I did this:
test = script.Parent.Brick
while true do test.Transparency = 0.9 wait(0.5) test.Transparency = 0.1 wait(0.5) end
I would of expected that when I classified Brick and there is 10 items named Brick. They would all be affected. But no, only 1 was changing transparency. Then I figured out that you have to change each brick's name to be different from each other. For example:
Model Script Brick1 Brick2 Brick3 Brick4 Brick5 Brick6 Brick7 Brick8 Brick9 Brick10
And the script would be this:
test1 = script.Parent.Brick1 test2 = script.Parent.Brick2 test3 = script.Parent.Brick3 test4... test5... test6... test7... test8... test9... test10...
while true do test1.Transparency = 0.9 test2.Transparency = 0.9 test3.Transparency = 0.9 ... wait(0.5) test1.Transparency = 0.1 test2.Transparency = 0.1 test3.Transparency = 0.1 ... wait(0.5) end
But I don't want to change each of brick's names and do the same thing in the scripting. Is there a script where all bricks in the model will be affected to all of the same named bricks?
Please Respond. Appreciate the support. |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2011 06:10 PM |
If you have a Model filled with just bricks then:
Model = game.Workspace.Model:getChildren()
for i = 1, #Model do Model[i].Name = "pie" end
All of the bricks' names change to pie.
~Read Between the Squiggles~ |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2011 06:14 PM |
You could also do something like this:
for _,v inpairs(script.Parent:GetChildren()) do if v:IsA("Part") then v.Transparency = 0.1 end
This snippet makes all parts of the model (script.Parent) into Transparency=0.1 |
|
|
| Report Abuse |
|
|
| |
|