|
| 05 Mar 2016 09:56 PM |
[How can I make this scan more things like "Lighting" and scan the descendants of whats in workspace (the items) not just whats in workspace, until it gets to the last descendant of every item.
Removelist = {"Hax","Virus"} while true do wait(0.1) things = game.Workspace:GetChildren() for i = 1, #things do local nana = false for v = 1, #Removelist do if things[i].Name == Removelist[v] then nana = true end end if nana then print("Virus: '"..things[i].Name.."' Has been removed.") things[i]:remove() end end end
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
Contrary
|
  |
| Joined: 08 Jan 2011 |
| Total Posts: 1306 |
|
| |
|
| |
|
|
| 05 Mar 2016 10:08 PM |
Something like this might work.
local Removelist = {"Hax","Virus"} local function Removeall() for index = 1, #Removelist do local name = Removelist[index] while true do local child = game:FindFirstChild(name, true) if child then child:Destroy() else break end end end end
game.DescendantAdded:connect(Removeall) |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 05 Mar 2016 10:09 PM |
local function getDescendants(root, ...) --// root == instance where scan starts; --// ... == optional class filters. If not provided, all descendants are returned local temp = pcall(game.IsA, root, "Instance") and {root} or {} local children = {} local classes = (...) ~= nil and {...} or {"Instance"} for _, descendant in ipairs(temp) do for _, child in ipairs(descendant:GetChildren()) do if pcall(game.IsA, child, "Instance") then temp[#temp+1] = child for _, class in ipairs(classes) do if child:IsA(class) then children[#children+1] = child break end end end end end return children end
print(#getDescendants(game, "BasePart", "Camera")) --// look at all descendants of game that are either BaseParts or Cameras |
|
|
| Report Abuse |
|
|
|
| 05 Mar 2016 10:18 PM |
[Scan more things like, lighting...]
virus = {"Hax","Virus"} function scan(v) for x,y in pairs(v:GetChildren()) do for i = 1,#virus do if #y:GetChildren() > 0 and y.Name ~= virus[i] then coroutine.resume(coroutine.create(function() scan(y) end)) elseif y.Name == virus[i] then print("AntiSploit has removed: '"..y.Name.."' Virus from your game.") y:Destroy() end end end end scan(workspace) |
|
|
| Report Abuse |
|
|