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

Copying or Destroying Children? [Still need CopyChildren]!

Is there such thing as CopyAllChildren() or ClearAllChildren()? if not then how would I clone clone or destroy the children that I got from something?

2 comments

0

I meant not CopyAllChildren() I meant CloneChildren() sry...

0

:ClearAllChildren()

1 answer

CopyAllChildren() doesn't exist as far as I know.

ClearAllChildren() does exist however. Here's an example for using it.

game.Workspace:ClearAllChildren() -- If its in workspace, it will be removed.

game.Lighting:ClearAllChildren() -- If its in lighting, it will be removed.

game.Teams:ClearAllChildren() -- If its in teams, it will be removed.

To clone something, its fairly simple. Here's an example.

game.Workspace.Part:Clone() -- This will clone the part named "Part."

However, you can also simply destroy one specific thing rather than destroying it all. There is two methods.

game.Workspace.Part:Destroy() -- This will destroy the part named "Part."

game.Workspace.Part:Remove() -- This will remove the part named "Part."

I don't really see a difference between Destroy() and Remove(), but hey, it's your choice on what to use. I hope I was helpful. :)

2 comments

0

thnx but I mean, i wanna clone children of something, not the Parent istelf...

0

Use :GetChildren() and BAM!

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