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

How to use get children to copy multiple parts?

I want to create a script that copies all of the children from one model and copies them into a another model. How can I copy all of the parts at once without creating a variable for each part??

2 comments

0

You'd want to do something like this: https://www.youtube.com/watch?v=mk0jUsi7oI8

0

So basically to summarize that video: Do your model:GetChildren() and put that into a list. Then have a loop iterate through each part in that list, and :Clone() each part into the other model. But also make sure to check if each part in the first model has children, and if those parts have children, etc.

1 answer

✓ Accepted answer

Here is the code which should help you. Just fill in where the locations of the models.

local Model = game.Workspace.ToCopy:GetChildren()

for _,v in pairs(Model) do
local Clone = v:Clone()
Clone.Parent = game.Workspace.ModelToPutInto
end

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