025110
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 57661 |
|
|
| 02 Jan 2015 10:05 PM |
local virusname = "Virus" for _,v in pairs(workspace:GetChildren()) do if v.Name == virusname then v:Destroy() for _, bricks in pairs(v:GetChildren()) do if bricks.Name == virusname then bricks:Destroy() end end end end |
|
|
| Report Abuse |
|
|
025110
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 57661 |
|
|
| 02 Jan 2015 10:08 PM |
| it removes the parts named "virus" in the workspace but not in the parts |
|
|
| Report Abuse |
|
|
mew903
|
  |
| Joined: 03 Aug 2008 |
| Total Posts: 22071 |
|
|
| 02 Jan 2015 10:08 PM |
function searchForVirus(Name, Object) for _, v in next, Object:GetChildren() do if v.Name:lower() == Name:lower() then v:Destroy(); end; searchForVirus(Name, v); end; end;
searchForVirusAndDestroy('Fire', Game);
recursion would be your best bet here. example i threw up^ |
|
|
| Report Abuse |
|
|
025110
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 57661 |
|
|
| 02 Jan 2015 10:11 PM |
is there a wiki for that? I'd like 2 kno more |
|
|
| Report Abuse |
|
|
mew903
|
  |
| Joined: 03 Aug 2008 |
| Total Posts: 22071 |
|
|
| 02 Jan 2015 10:12 PM |
| http://www.lua.org/pil/6.3.html |
|
|
| Report Abuse |
|
|