|
| 13 May 2014 11:02 AM |
| Could I do GetChildren().destroy()? cos I really need to know, if not the how |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 11:06 AM |
| Also, how would I clone the Got Children? |
|
|
| Report Abuse |
|
|
FoolHater
|
  |
| Joined: 17 Jul 2008 |
| Total Posts: 2141 |
|
|
| 13 May 2014 11:20 AM |
local children = Workspace:GetChildren() --returns a table of children for i = 1, #children do children[i]:Destroy() --loops through table end |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 11:20 AM |
i think you need to look into what :GetChildren() actually does and what it returns.
|
|
|
| Report Abuse |
|
|
FoolHater
|
  |
| Joined: 17 Jul 2008 |
| Total Posts: 2141 |
|
|
| 13 May 2014 11:23 AM |
local children = Workspace:GetChildren() --returns a table of children for i = 1, #children do childcopy = children[i]:Clone() --clones each child in the table of children childcopy.Parent = Workspace --cloned child is parented to the Workspace wait(1) end |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 12:03 PM |
k, thnx... also, could I not do this? ClonedParts = Workspace:GetChildren() ClonedParts:destroy()? |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 12:08 PM |
for I,v in pairs(ClonedParts) do v:Destroy() end
or you could simply
Workspace:ClearAllChildren() |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 12:11 PM |
| so ClearAllChildren :D thnx... btw, is thre a short way to copy children? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 13 May 2014 01:19 PM |
Here's what you wanted...
function CloneAllChildren(OldPar, NewPar) for _,v in ipairs(OldPar) do v:Clone().Parent = NewPar end end
CloneAllChildren(Workspace.Model, Workspace)
Or you could just clone the model itself... |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 01:45 PM |
| thnx, at lastsomeone answered! :D and also, can the clonechildren be done shorter like ClearAllChildren? |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 01:46 PM |
| Clone children isn't a method, it is a function. That I made. |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 01:55 PM |
| oh... so it cant be 1 line :( |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 01:56 PM |
| also, do I rename the OldPar to the name of the Object that am gettin the Children from, and NewPar is were to paste it? |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 02:00 PM |
you can make anything one line.. even a 12000 line long script can be condensed into just one line...
|
|
|
| Report Abuse |
|
|
| |
|
|
| 13 May 2014 02:02 PM |
verified, then how would I do it? and thnx desp, but islandmaker already told me about ClearAllChildren, thnx anyway :D |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 02:03 PM |
| You can run a lot of things in one line but it's more organized to make multiple lines. Take the command bar for example. |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 02:04 PM |
im just saying that
while wait() do print('examples'); end
can be condensed to
while wait()do print'examples'end
|
|
|
| Report Abuse |
|
|
|
| 13 May 2014 02:06 PM |
| lol I knew it XD but was worth asking... but is there no shorter way to clone AllChildren than wat warspy said? |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 02:07 PM |
i dont get why why you it any shorter, its only like 7 lines...
|
|
|
| Report Abuse |
|
|
|
| 13 May 2014 02:10 PM |
| my scripts are short... anyways, tell me, OldPar and NewPar, are they the Places of the cloned objects? |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 02:11 PM |
| for i,v in pairs(parent:GetChildren()) do v:Clone().Parent = newpar end |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 02:14 PM |
| lemme see... but is the starting locationf of the object in the brackets? cos if yes then y is it Parent? |
|
|
| Report Abuse |
|
|