Aerolus
|
  |
| Joined: 05 Sep 2011 |
| Total Posts: 847 |
|
|
| 13 Oct 2013 09:09 AM |
Hey, I'm having some issues with cloning the children of a model in Lighting into a model in Workspace.
game.Lighting["Obby"]:Clone().Parent = game.Workspace.moved --this is just fine
How would I GetChildren of "Obby" and move it into "game.Workspace.moved"?
|
|
|
| Report Abuse |
|
|
mic144
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 1598 |
|
|
| 13 Oct 2013 09:22 AM |
If Obby is a model I suggest you move the entire model.
But here:
obbyp = game.Lighting:findFirstChild("Obby") for _, v in pairs(obbyp:getChildren()) do if v:IsA("Part") or v:IsA("Wedge") or v:IsA("Truss") then v.Parent = workspace.moved
end end
You might want to move them back because I didnt clone them for you. |
|
|
| Report Abuse |
|
|
|
| 13 Oct 2013 09:22 AM |
"if v:IsA("Part") or v:IsA("Wedge") or v:IsA("Truss") then" if v:IsA("BasePart") then |
|
|
| Report Abuse |
|
|
Aerolus
|
  |
| Joined: 05 Sep 2011 |
| Total Posts: 847 |
|
|
| 13 Oct 2013 09:23 AM |
When I try to clone the children its treating Clone like a nil value here:
game.Lighting["Obby"]:GetChildren():Clone().Parent = game.Workspace.moved |
|
|
| Report Abuse |
|
|
|
| 13 Oct 2013 09:24 AM |
:GetChildren() returns a table You`re trying to clone something like this table = {Part1,Part2,Part3} See the problem? |
|
|
| Report Abuse |
|
|
Aerolus
|
  |
| Joined: 05 Sep 2011 |
| Total Posts: 847 |
|
|
| 13 Oct 2013 09:24 AM |
| I know how to move the entire model, but if I move it into the model in Workspace then I'd want to ungroup it. In the place there would be several models in the model in Workspace which wouldn't run how it should, it needs to be individual parts. |
|
|
| Report Abuse |
|
|
|
| 13 Oct 2013 09:24 AM |
--nonononononono..
local children1 game.Lighting.Obby:GetChildren() children1.Parent = game.Workspace.moved |
|
|
| Report Abuse |
|
|
|
| 13 Oct 2013 09:24 AM |
function GetParts(Model) for i,v in pairs(Model:GetChildren()) do if v:IsA("BasePart") then v:clone().Parent=game.Workspace else GetParts(v) end end end
GetParts(game.Lighting.Obby) |
|
|
| Report Abuse |
|
|
|
| 13 Oct 2013 09:26 AM |
| Okay aeroulus, my script gets EVERY descendant that's a part and seperates it, so you don't have to ungroup stuff in lighting or anything. |
|
|
| Report Abuse |
|
|