Kniv979
|
  |
| Joined: 05 Jan 2009 |
| Total Posts: 167 |
|
|
| 17 Jul 2014 04:42 PM |
What would be the best way to, for an instance making all childrens in a model to turn invisible?
|
|
|
| Report Abuse |
|
|
|
| 17 Jul 2014 04:44 PM |
for i, v in next, obj:GetChildren() do if v:IsA'BasePart' then v.Transparency = 1.5 end end |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2014 04:45 PM |
function Invisible(Model) for _,v in pairs(Model:GetChildren()) do if v:IsA("BasePart") then v.Transparency = 1 end Invisible(v) end end
Invisible(Workspace.ModelNameHere)
~The herp lerped a derp~ |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2014 04:46 PM |
Gosh darn weird-headed script ninjas D:
~The herp lerped a derp~ |
|
|
| Report Abuse |
|
|
| |
|
Kniv979
|
  |
| Joined: 05 Jan 2009 |
| Total Posts: 167 |
|
|
| 17 Jul 2014 05:10 PM |
I've got a question through. When you do GetChildren() on a model, it returns with a table right? Now to modify each children you'll need a loop. But why? Wouldn't it just be simplier if GetChildren() didn't print a table but instead all parts name, location, etc? |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2014 05:11 PM |
| Because that would make no sense. |
|
|
| Report Abuse |
|
|
Kniv979
|
  |
| Joined: 05 Jan 2009 |
| Total Posts: 167 |
|
|
| 17 Jul 2014 05:13 PM |
I've got a question through. When you do GetChildren() on a model, it returns with a table right? Now to modify each children you'll need a loop. But why does it work? |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2014 05:14 PM |
| The for loop will iterate through the table, returning the key-value pairs until it returns nil, where it terminates. |
|
|
| Report Abuse |
|
|
Kniv979
|
  |
| Joined: 05 Jan 2009 |
| Total Posts: 167 |
|
|
| 17 Jul 2014 05:18 PM |
Ah that makes sense. Thanks! Also sorry for double posting, my internet is really slow so i couldn't really see if the old message actually got sended or not. |
|
|
| Report Abuse |
|
|