|
| 05 Mar 2015 03:29 PM |
| Is it possible to un-group a model with script? |
|
|
| Report Abuse |
|
|
|
| 05 Mar 2015 03:31 PM |
| Sadly, I do not know. If not, then put all the parts in a part, and clone the part out of the model, and delete the model. |
|
|
| Report Abuse |
|
|
|
| 05 Mar 2015 03:31 PM |
| Clone all the children to its parent and remove the model, tada ;3 |
|
|
| Report Abuse |
|
|
LuaLlama
|
  |
| Joined: 25 Jan 2014 |
| Total Posts: 1123 |
|
|
| 05 Mar 2015 03:34 PM |
Model = game.Workspace.Model -- or whatever Other = game.Workspace.Model2 -- this is where we move it
Parts = Model:GetChildren() for i=1,#Parts do Part = Parts[i] Part.Parent = Other end
|
|
|
| Report Abuse |
|
|
Stefan631
|
  |
| Joined: 23 Dec 2010 |
| Total Posts: 1350 |
|
|
| 05 Mar 2015 03:39 PM |
--ungroup
local model = workspace.Model; for _, v in pairs(model:getChildren()) do v.Parent = v.Parent.Parent; end; |
|
|
| Report Abuse |
|
|
|
| 05 Mar 2015 03:41 PM |
@Lua
Ew...
ew...
gross... why even...
function ungroup(model,parent) for i,v in next, model:GetChildren() do pcall(function() v.Parent = parent end) end end
usage:
ungroup(game.Workspace.Model,workspace) |
|
|
| Report Abuse |
|
|
LuaLlama
|
  |
| Joined: 25 Jan 2014 |
| Total Posts: 1123 |
|
|
| 14 Mar 2015 12:23 AM |
@Above,
My code is crap ik.
I use old ways of doing things. I like to take the simple way of doing things. |
|
|
| Report Abuse |
|
|
|
| 14 Mar 2015 05:06 AM |
game:GetService("TestService"):DoCommand("UnGroup")
It'll only work via cmd in studio though. |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 14 Mar 2015 05:12 AM |
function Ungroup(model) assert(model, "You must be trying really hard here", 2); assert(model:IsA("Model"), "Not a model you fool", 2); for _,i in next,model:GetChildren() do i.Parent = model.Parent; end; model:Destroy(); end; |
|
|
| Report Abuse |
|
|
GetCoded
|
  |
| Joined: 14 Jul 2012 |
| Total Posts: 47 |
|
|
| 14 Mar 2015 07:12 AM |
a = game.Workspace.Model
for i = 1, #a do a[i].Parent = game.Workspace end |
|
|
| Report Abuse |
|
|
|
| 14 Mar 2015 06:15 PM |
clone:part(2) = workspace.game
m9 = eeeee.parebr
if ebr = sdad then kill(duad023);
cout << "Done.";
cin >> m9;
if(m9 == dasd){ cout << "m9" } |
|
|
| Report Abuse |
|
|
|
| 04 Jan 2017 12:29 PM |
This is mine, its pretty simple:
modelRoot = game.workspace.Tower -- The model you want to ungroup targetRoot = game.workspace -- The place you want to put the ungrouped model
for index, child in pairs(modelRoot:GetChildren()) do child.Parent = (targetRoot) end
modelRoot:Destroy()
|
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Jun 2017 02:16 PM |
I was pretty interested on this post, and I was kind of asking myself why I never needed to write a script like this before. I just wrote one right here because I was bored, #### I have not tested it, but it should work. Unfortunately, there are other scripts out there that will ungroup a model, but the other models inside it remain intact. This ### ###### ####### every single model and folder inside the model. I am open to constructive criticism as I have not tested this. If it errors, feel free to tell me. I added some notes as an attempt to make you have a greater understanding of the script.
-- script should be a child of whatever model you want to ungroup --
local model = (script.Parent) -- or whatever root you want --
while true do wait(0.01) for index,child in ipairs(model:GetChildren()) do if child:IsA('Model') or child:IsA('Folder') then -- locating models -- for index,CHILD in ipairs(child:getChildren()) do CHILD.Parent = model -- regrouping full model children -- for index,_CHILD_ in ipairs(CHILD:getChildren()) do _CHILD_.Parent = model end end if child:getChildren()[1] == nil then -- locating empty models -- child:destroy() -- deleting empty models -- end end end end |
|
|
| Report Abuse |
|
|