How to ungroup a model using code

Is there a way to ungroup a model using code?

13 Likes

Iterate through all children of the model and set parent to model.Parent (or any other parent). Optionally call Destroy() on model afterwards to immitate the exact behavior of studio ungroup.

13 Likes

Don’t have much else to do but I’ll give an example of what @TaaRt was explaining.

Model = workspace.Model --Model you want to destroy

for _, Child in pairs(Model:GetChildren()) do
    Child.Parent = Model.Parent --Move the children up one parent
end

Model:Destroy() --Destroy the model afterwards

@Kevinllululala

54 Likes

Please mark one of these posts as a solution, or else this topic will remain open forever. It’s been 6 years

11 Likes

He isn’t active on the forum anymore, so he can’t!

4 Likes

I like how I get suggested this post from so long ago

8 Likes

For real. I don’t know why Roblox does this and then they are mad when we reply.

3 Likes

close this thread

..

68969

2 Likes

Why do yall care bruh whats wrong with it being open theres literally many open topic

2 Likes

who here in 2024?? such a nostalgic post

7 Likes

2024 bois rise up ############

3 Likes

this is the funniest thing i have read on this site. didn’t even realize the post was so old until i saw this.

1 Like

i made a huge mistake accidentally reviving this

Hilarious to see something like this, changes are the original poster is inactive too so it’s open until it fades back into obscurity, it should automatically close threads without activity for over a month

last words kevin ever said before he disappeared from the planet :broken_heart: