generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: [Simple] Question...

Previous Thread :: Next Thread 
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
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
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
05 Mar 2016 09:59 PM
b1
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
05 Mar 2016 10:05 PM
b2
Report Abuse
Contrary is not online. Contrary
Joined: 08 Jan 2011
Total Posts: 1306
05 Mar 2016 10:06 PM
Use recursions
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
05 Mar 2016 10:08 PM
Example.
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
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 is not online. 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
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image