|
| 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
|
  |
| 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 |
|
|
|
| 01 Mar 2016 10:19 PM |
for _,v in pairs(model:GetChildren()) do v.BrickColor = BrickColor.Black() end |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 01 Mar 2016 10:21 PM |
| yes i realized i spelled it TransParency thats not an issue though so ignore it |
|
|
| Report Abuse |
|
|
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 |
|
|
| |
|
|
| 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
|
  |
| 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
|
  |
| Joined: 11 Feb 2015 |
| Total Posts: 223 |
|
|
| 01 Mar 2016 11:08 PM |
while GunModelChildren == nil do wait() end ^^
|
|
|
| Report Abuse |
|
|
|
| 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 |
|
|