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

Ungroup script for InsertService?

local assetId=47637
game:GetService("InsertService"):LoadAsset(assetId).Parent=scparent.Backpack

This creates a model in the player's Backpack, how could I ungroup it using code?

1 answer

✓ Accepted answer

Essentials

What you're trying to do requires simply parenting the inserted model to your wanted location, iterating through said model, and parenting all of it's childern to the model's parent. Afterwards you can just delete the inserted model.


Code

local insert = game:GetService("InsertService")
local assetId 

function unGroup(model)
	for _,v in next,model:GetChildren() do
		v.Parent = model.Parent
	end
	model:Destroy()
end

local model = insert:LoadAsset(assetId)
model.Parent = scparent.Backpack

unGroup(model)

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