Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there a way for one to ungroup a model via a script?

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?

1 comment

0

Nope you have to code it.

2 answers

✓ Accepted answer

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.

2 comments

0

Didn't I already say that? Hmm...

0

it's the simplest way to do it

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

This discussion is preserved as it was. New answers, comments, and votes are closed.