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 » Scripters
Home Search
 

How do I get Children from get children

Previous Thread :: Next Thread 
ShootzoneFPS is not online. ShootzoneFPS
Joined: 03 Jan 2013
Total Posts: 103
01 Mar 2016 10:15 PM
So i need to getchildren from workspace.Lobby.GunModel
problem is that returns that lobby.gunmodel's child is a model, but i need the children of that model. so how do i get children from getchildren?
Report Abuse
Zechariax is not online. Zechariax
Joined: 22 Mar 2012
Total Posts: 206
01 Mar 2016 10:17 PM
local gunModelsChild = workspace.Lobby.GunModel.THENAMEOFTHEMODEL

local myTable = gunModelsChild:GetChildren()
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
01 Mar 2016 10:19 PM
for _,v in pairs(model:GetChildren()) do
v.BrickColor = BrickColor.Black()
end
Report Abuse
ShootzoneFPS is not online. ShootzoneFPS
Joined: 03 Jan 2013
Total Posts: 103
01 Mar 2016 10:19 PM
problem is THENAMEOFTHEMODEL is not always the same because the model is inserted later and the model that gets put there is a choice of the player.
Report Abuse
ShootzoneFPS is not online. ShootzoneFPS
Joined: 03 Jan 2013
Total Posts: 103
01 Mar 2016 10:20 PM
Heres what im trying to do

h = game.Workspace.Lobby.GunModel:GetChildren()
c = h:GetChildren()
for i = 1, #c do
if c[i].ClassName == "Union" or c[i].Material ~= "Neon" or c[i].TransParency < 1 then
c[i].Material = "Concrete"
script.type.Value = 2
script.Parent.Parent.Parent.CF.Visible = false
end
end
Report Abuse
ShootzoneFPS is not online. ShootzoneFPS
Joined: 03 Jan 2013
Total Posts: 103
01 Mar 2016 10:21 PM
yes i realized i spelled it TransParency thats not an issue though so ignore it
Report Abuse
Zechariax is not online. Zechariax
Joined: 22 Mar 2012
Total Posts: 206
01 Mar 2016 10:23 PM
If there is only 1 model in the GunModel, then do this

local GunModelChildren = game.Workspace.Lobby.GunModel:GetChildren()

local modelinGunModel

for i,v in ipairs(GunModelChildren) do
if v:IsA('Model') then
v = modelinGunModel
end

local childs = modelinGunModel:GetChildren()
Report Abuse
ShootzoneFPS is not online. ShootzoneFPS
Joined: 03 Jan 2013
Total Posts: 103
01 Mar 2016 10:24 PM
Thank you zech
Report Abuse
ShootzoneFPS is not online. ShootzoneFPS
Joined: 03 Jan 2013
Total Posts: 103
01 Mar 2016 10:30 PM
actually zech, can you add a waiting protocol somewhere in your function? the model in Gunmodel isnt there instantly and its causing modelinGunModel to return nil
Report Abuse
Zechariax is not online. Zechariax
Joined: 22 Mar 2012
Total Posts: 206
01 Mar 2016 10:45 PM
wait(0.1)
local GunModelChildren = game.Workspace.Lobby.GunModel:GetChildren()

local modelinGunModel

for i,v in ipairs(GunModelChildren) do
if v:IsA('Model') then
v = modelinGunModel
end

local childs = modelinGunModel:GetChildren()
Report Abuse
PrimeZest is not online. PrimeZest
Joined: 11 Feb 2015
Total Posts: 223
01 Mar 2016 11:08 PM
while GunModelChildren == nil do wait() end ^^


Report Abuse
ShootzoneFPS is not online. ShootzoneFPS
Joined: 03 Jan 2013
Total Posts: 103
01 Mar 2016 11:22 PM
actually that wasnt why it was returning nil I fixed the problem myself. Thanks for the help though.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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