generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Model GetChildren()

Previous Thread :: Next Thread 
Kniv979 is not online. 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
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
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
filiptibell is online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
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
filiptibell is online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
17 Jul 2014 04:46 PM
Gosh darn weird-headed script ninjas D:

~The herp lerped a derp~
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
17 Jul 2014 04:47 PM
:)
Report Abuse
Kniv979 is not online. 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
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
17 Jul 2014 05:11 PM
Because that would make no sense.
Report Abuse
Kniv979 is not online. 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
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image