I was wondering if scripts can un-group models in workspace or lighting.
COMMUNITY QUESTION
Can scripts un-group models?
2 answers
You could find and clone all the descendants of the model, delete the model, then set the parent of the cloned descendants to the place it should be. I'm not aware of any API to directly do this though.
Yes, but there is no function for it. Here is an example of it.
Model = Workspace.SampleModel -- Find the model
ModelParent = Model.Parent -- Find the parent of the model
for i, v in pairs(Model:GetChildren()) do -- Parent all the children of the model to the parent of the model
v.Parent = ModelParent
end
Model:remove() -- Remove the model
This script is very simple and I believe that it would work considering the hierarchy is correct.
This discussion is preserved as it was. New answers, comments, and votes are closed.
