Rex005X
|
  |
| Joined: 28 Apr 2016 |
| Total Posts: 1245 |
|
|
| 18 Sep 2017 11:15 AM |
GetChildren just gives you a "Read-Only" list. I need to clone all the children inside a model, so I can copy it and move it into another model using scripts. |
|
|
| Report Abuse |
|
|
Rex005X
|
  |
| Joined: 28 Apr 2016 |
| Total Posts: 1245 |
|
|
| 18 Sep 2017 11:26 AM |
| Doesn't anyone know how to do this? |
|
|
| Report Abuse |
|
|
| |
|
Rex005X
|
  |
| Joined: 28 Apr 2016 |
| Total Posts: 1245 |
|
|
| 18 Sep 2017 11:38 AM |
| No you don't understand, I don't want to clone the model, I want to clone it's children so I can move them to another model, I do not want the model itself cloned. |
|
|
| Report Abuse |
|
|
Rex005X
|
  |
| Joined: 28 Apr 2016 |
| Total Posts: 1245 |
|
| |
|
| |
|
igrach2
|
  |
| Joined: 09 Mar 2017 |
| Total Posts: 252 |
|
|
| 18 Sep 2017 11:43 AM |
for i,v in ipairs(model:GetChildren())do v:Clone().Parent=newmodel end |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2017 11:43 AM |
local newModel = ... local oldModel = ...
local copy = oldModel:Clone() for _, obj in pairs(copy:GetChildren()) do obj.Parent = newModel end newModel:MakeJoints() copy:Destroy() |
|
|
| Report Abuse |
|
|
Rex005X
|
  |
| Joined: 28 Apr 2016 |
| Total Posts: 1245 |
|
|
| 18 Sep 2017 11:45 AM |
local zChildren = game.Workspace.Model:GetChildren() zChildren:Clone() zChildren.Parent = Game.Workspace.Model2
Returns index error. |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2017 11:48 AM |
| because you created a local variable |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2017 11:50 AM |
| and why is game capitalised |
|
|
| Report Abuse |
|
|
igrach2
|
  |
| Joined: 09 Mar 2017 |
| Total Posts: 252 |
|
|
| 18 Sep 2017 11:52 AM |
wait() local model2=workspace.Model2 for i,v in ipairs(workspace.Model:GetChildren())do v:Clone().Parent=model2 end |
|
|
| Report Abuse |
|
|
Rex005X
|
  |
| Joined: 28 Apr 2016 |
| Total Posts: 1245 |
|
|
| 18 Sep 2017 11:58 AM |
^ Tried that, doesn't work, does not return an error though.
How would I make this script below work? zChildren = game.Workspace.Model:GetChildren() zChildren:Clone() zChildren.Parent = game.Workspace.Model2
I honestly don't understand, sorry if I am upsetting any of you, I'm still learning how to script. |
|
|
| Report Abuse |
|
|
Rex005X
|
  |
| Joined: 28 Apr 2016 |
| Total Posts: 1245 |
|
|
| 18 Sep 2017 12:02 PM |
local zChildren = game.Workspace.Model:GetChildren() local Cloned = zChildren:Clone() Cloned.Parent = game.Workspace.Model2
Returns clone nil value. |
|
|
| Report Abuse |
|
|