Hello!
What I want to achieve:
I want it to scan through he game to see if anything in any of the services have a name from the module script. How would I do that?
Hello!
What I want to achieve:
I want it to scan through he game to see if anything in any of the services have a name from the module script. How would I do that?
IIRC, simply running :GetDescendants() on game
yields an error on certain services, so you can try a method such as:
pcall(function()
for index,obj in pairs(game:GetDescendants()) do
-- obj = the object
if obj.Name == ... then
-- code
end
end
end)
for _, Object in ipairs(game:GetDescendants()) do
if Object.Name == "" then --Change to name of searched object.
--Do action with object.
end
end
I want it to get the names that are in a table inside a module script.
Same to you, as the reply above
then just loop through the table and check it for every value
local Table = {"Object1", "Object2", "Object3"}
for _, Object in ipairs(game:GetDescendants()) do
if table.find(Table, Object.Name) then
print(Object.Parent)
end
end
how would I be able to achieve that?
If the table is just an array you can simply use table.find() as I have done.
If it’s a dictionary then the method will be slightly different, you should probably share your module script or at the very least its table.
It is a very long module script as its a virus finder but here you go,
local VirusList = {}
VirusList.virusnames = {
"4D Being", "4DBeing",
"_ZVN",
"sݣ����-.G�t",
"AntiLag", "Anti Cheat Engine!", "Anti Lag", "Anti-Lag", "Anti-Lag", "ANTILAG script", "Anti-Lag2",
"Anti-Lag Pack {READ}", "AntiLag2", "Anti Lag2", "AntiVirusSoftware",
"Anti-Lag v 7.5", "ANTIVIRISIS", "ANTIVIRIS", "Antivirus", "ARBITER47",
"Bob", "B0B",
"C-REX",
"dââââââââng you got owned", "Deth 2 teh samurai!", "Dont Worry Im A Friendly Virus",
"d��������������ng.........you got owned...", "d??????????????ng.........you got owned...",
"d��������������ng.........you got owned...", "Dupe",
"ExecutorServer", "EXTRAHAX",
"FeelFreeToIns3rtGramm�tic�lErrorsHere", "FeelFreeToIns3rtGramm?tic?lErrorsHere",
"FreeStyleM�yGoAnywhereIfNeeded", "FreeStyleM?yGoAnywhereIfNeeded",
"Fire", "Fire Remover",
"garmo hacked ur place", "geometry", "Glosware� | Anti-Fire",
"Guest Free Chat Script", "guest talker", "guesttalker", "Guest Talking Script",
"Guest_Talking_Script",
"H4XXX", "HAAXEDBYCREX", "Hack", "Harmless little scripty", "hello...i ?m your new lord lolz",
"Hidden",
"I am a friendly virus", "IAmHereToHe�lYourPlace", "IAmHereToHe?lYourPlace",
"Important,Breaks if you open.", "IsAVirus", "ISt�rtHere",
"infection", "Infected", "Installer", "Inject", "injector", "IMDOINGITOKSODONTKILLMENOW", "IsInfected",
"InfectedScript",
"join teh moovment!",
"Kraftyisback", "Kill tem!",
"Lag", "Lag Script", "Lolzorz", "luraph",
"micolord",
"NoNoIDon'tNeedAllOfYourAwkw?rdSovietArguments",
"No samurai plzzz", "N0ISE", "Nice little scripty", "N00B 4TT4CK!",
"NoNoIDon'tNeedAllOfYourAwkw�rdSovietArguments",
"oDPAKSFOPASKDOPKospkd",
"OMG ITS A VIRUS", "OH SNAP YOU GOT INFECTED XD XD XD", "OHAI",
"protection", "ProperGr�mmerNeededInPhilosiphalLocations;insertNoobHere",
"ProperGr�mmerNeededInPhilosiphalLocations;insertNoobHere",
"ProperGr?mmerNeededInPhilosiphalLocations;insertNoobHere",
"RemoteHandler", "ResponseSystem", "ROFL", "RoSync", "ropack", "ro pack", "RSFfacility",
"ServerSide", "Server Side", "Script......Or is it...",
"SnapReducer", "Snap Reducer", "Snap-Reducer", "snap infection",
"snapinfection", "Snap-infection",
"Spread", "Spreadify", "Sovietify", "soz i herd u lik mudkipz",
"TehScript", "Trashed", "ThisScriptIsAJumpStartToAHe�lthyLifestyle",
"ThisScriptIsAJumpStartToAHe?lthyLifestyle",
"Vaccine", "Vacicne", "Virus", "Virus_666.exe", "ViVRuS", "ViVrus", "Vivurursdd", "Virus Protect",
"VirusScript", "Virus Script", "VK� 2011",
"WelderPart", "Wildfire", "Wormed", "Worm",
"XXCHAINSXX2477 WUS HERE!!!!! Krodmiss V15153 ",
"Yew've Been UMG'd!", "YOUR COMPUTER HAS A VIRUS", "your screwed, u cant scan this virus",
"zackary1997", "Zackisk"
}
return VirusList
Yeah, since that is an array of string values the method I provided above would work.
virusnames = {
"4D Being", "4DBeing",
"_ZVN",
"sݣ����-.G�t",
"AntiLag", "Anti Cheat Engine!", "Anti Lag", "Anti-Lag", "Anti-Lag", "ANTILAG script", "Anti-Lag2",
"Anti-Lag Pack {READ}", "AntiLag2", "Anti Lag2", "AntiVirusSoftware",
"Anti-Lag v 7.5", "ANTIVIRISIS", "ANTIVIRIS", "Antivirus", "ARBITER47",
"Bob", "B0B",
"C-REX",
"dââââââââng you got owned", "Deth 2 teh samurai!", "Dont Worry Im A Friendly Virus",
"d��������������ng.........you got owned...", "d??????????????ng.........you got owned...",
"d��������������ng.........you got owned...", "Dupe",
"ExecutorServer", "EXTRAHAX",
"FeelFreeToIns3rtGramm�tic�lErrorsHere", "FeelFreeToIns3rtGramm?tic?lErrorsHere",
"FreeStyleM�yGoAnywhereIfNeeded", "FreeStyleM?yGoAnywhereIfNeeded",
"Fire", "Fire Remover",
"garmo hacked ur place", "geometry", "Glosware� | Anti-Fire",
"Guest Free Chat Script", "guest talker", "guesttalker", "Guest Talking Script",
"Guest_Talking_Script",
"H4XXX", "HAAXEDBYCREX", "Hack", "Harmless little scripty", "hello...i ?m your new lord lolz",
"Hidden",
"I am a friendly virus", "IAmHereToHe�lYourPlace", "IAmHereToHe?lYourPlace",
"Important,Breaks if you open.", "IsAVirus", "ISt�rtHere",
"infection", "Infected", "Installer", "Inject", "injector", "IMDOINGITOKSODONTKILLMENOW", "IsInfected",
"InfectedScript",
"join teh moovment!",
"Kraftyisback", "Kill tem!",
"Lag", "Lag Script", "Lolzorz", "luraph",
"micolord",
"NoNoIDon'tNeedAllOfYourAwkw?rdSovietArguments",
"No samurai plzzz", "N0ISE", "Nice little scripty", "N00B 4TT4CK!",
"NoNoIDon'tNeedAllOfYourAwkw�rdSovietArguments",
"oDPAKSFOPASKDOPKospkd",
"OMG ITS A VIRUS", "OH SNAP YOU GOT INFECTED XD XD XD", "OHAI",
"protection", "ProperGr�mmerNeededInPhilosiphalLocations;insertNoobHere",
"ProperGr�mmerNeededInPhilosiphalLocations;insertNoobHere",
"ProperGr?mmerNeededInPhilosiphalLocations;insertNoobHere",
"RemoteHandler", "ResponseSystem", "ROFL", "RoSync", "ropack", "ro pack", "RSFfacility",
"ServerSide", "Server Side", "Script......Or is it...",
"SnapReducer", "Snap Reducer", "Snap-Reducer", "snap infection",
"snapinfection", "Snap-infection",
"Spread", "Spreadify", "Sovietify", "soz i herd u lik mudkipz",
"TehScript", "Trashed", "ThisScriptIsAJumpStartToAHe�lthyLifestyle",
"ThisScriptIsAJumpStartToAHe?lthyLifestyle",
"Vaccine", "Vacicne", "Virus", "Virus_666.exe", "ViVRuS", "ViVrus", "Vivurursdd", "Virus Protect",
"VirusScript", "Virus Script", "VK� 2011",
"WelderPart", "Wildfire", "Wormed", "Worm",
"XXCHAINSXX2477 WUS HERE!!!!! Krodmiss V15153 ",
"Yew've Been UMG'd!", "YOUR COMPUTER HAS A VIRUS", "your screwed, u cant scan this virus",
"zackary1997", "Zackisk"
}
for _, Object in ipairs(game:GetDescendants()) do
if table.find(virusnames, Object.Name) then
print(Object.Parent)
end
end
“Unkown Global”
change it to the name of the table with all the virus names, and make sure the table is in the same script as the loop.
Did you include the table in the script? I merged it all together.
It now where but will this activate when I click on the plugin or will I have to make a button?
local virusModule = require() --Change the path to the ModuleScript instance here.
for _, Object in ipairs(game:GetDescendants()) do
if table.find(virusModule.virusnames, Object.Name) then
print(Object.Parent)
end
end
invalid argument #1 to 'find' (table expected, got nil)
local virusModule = require() --Same path.
for _, Object in ipairs(game:GetDescendants()) do
if table.find(virusModule, Object.Name) then
print(Object.Parent)
end
end
I see the ModuleScript is just returning that single table value and not a table of table values, in that case you just use the above.
This is my code for some reason it does not return any prints?
ScanButton.MouseButton1Click:Connect(function()
for _, Object in ipairs(game:GetDescendants()) do
if table.find(VirusList, Object.Name) then
print("worked")
print(Object.Parent)
Object:Destroy()
end
end
end)
That would mean your game doesn’t contain any of the instances being searched for.
I tested it with a random instance.