Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Copying or Destroying Children? [Still need CopyChildren]!

Asked by
KAAK82 16
10 years ago

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?

0
I meant not CopyAllChildren() I meant CloneChildren() sry... KAAK82 16 — 10y
0
:ClearAllChildren() IntellectualBeing 430 — 10y

1 answer

Log in to vote
1
Answered by 10 years ago

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. :)

0
thnx but I mean, i wanna clone children of something, not the Parent istelf... KAAK82 16 — 10y
0
Use :GetChildren() and BAM! OniiCh_n 410 — 10y
Ad

Answer this question