When editing in studio you can group and ungroup objects/assets you've created. Is there a way you can ungroup or group an object through a script. I know you can use a loop to access the objects inside the group and change their parent, the delete the group itself. However is there a simple command to do this?
This is actually really simple:
local model = script.Parent.Model local children = model:GetChildren() for _,i in pairs(children) do i.Parent = workspace end
All you have to do is run a for loop through the children of the model and make all of their parents the Workspace.
local model = Instance.new('Model', game.Workspace) model.Name = 'Model' local parta = script.Parent.PartA local partb = script.Parent.PartB parta.Parent = model partb.Parent = model
Simple and Easy