|
| 31 Aug 2013 10:48 PM |
num = 0 checked = 0 moss = nil function Check(moss) moss = moss if moss ~= nil then if moss.ClassName == "Fire" then moss:Remove() num = num + 1 end all = moss:getChildren() if #all ~= 0 then all = moss:getChildren() for a=1,#all do Check(all[a]) end end checked = checked + 1 end end all = Workspace:getChildren() for a=1,#all do Check(all[a]) end print("----------") print(num.." found and removed") print(checked.." looked inside but not infected") print("----------")
It only replies that it found 3 when there is easily more then 400 bricks in the game.
I also need to know how to print the full location on where a object is. Such as a tree
print(moss.Parent) > Place1.game.Workspace.Model.Model.Model.Model.Part |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2013 10:53 PM |
"I also need to know how to print the full location on where a object is." Part:GetFullName() To lazy to read the script |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 31 Aug 2013 10:58 PM |
Regarding tree:
part = Workspace.Part get = part str = part.Name
while (not get:IsA('DataModel')) do get = get.Parent str = get.Name..'.'..str end str = 'Game.'..str |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 31 Aug 2013 10:58 PM |
@lam jesus christ when did such a method come out you can't teach an old doge new tricks |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2013 11:03 PM |
Didn`t bother reading your script This script will Recurse the workspace and delete all fire/ take note how many there are
fire = 0 checked = 0
function Recurse(Part) checked = checked + 1 if Part:IsA("Fire") then Part:Destroy() fire = fire + 1 end Children = Part:GetChildren() if #Children == 0 then return end for _,v in pairs(Children) do Recurse(v) end end Recurse(game.Workspace) safe = checked - fire print("Fire: " .. fire .. " Checked: " .. checked .. " Not infected: " .. safe) |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2013 11:09 PM |
function Clear(Parent, NameOrClassName) local x = 0 local function Scan(parent) for index, child in pairs(parent:GetChildren()) do if child:IsA(NameOrClassName) or child.Name = NameOrClassName then child:Destroy() x = x + 1 end Scan(child, NameOrClassName) end end Scan(Parent) return x end
local Amount = Clear(Workspace, "Fire") print(Amount.." found.") |
|
|
| Report Abuse |
|
|