you see, I'm trying to make this anti-virus to help developers. heres my script:
local toolbar = plugin:CreateToolbar("Troys Antivirus") local button = toolbar:CreateButton( "Scan For Suspicous names", "Click to scan for possible names of a virus", "http://www.roblox.com/asset/?id=36527138" ) button.Click:connect(function() print("Scanning for names...") plugin:Activate(true) -- Neccessary to listen to mouse input end) function VirusNameScan() local child = game.Workspace:GetChildren() if child.Name == "virus" or " virus" or "YOUR AN IDIOT" or "troll" then child:Destroy() end end print("Scan complete.")
ok, here's my problem; it keeps getting stuck on "Scanning for names...". Any ideas on how to fix this?
Thanks for reading!
There's multiple problems.
1) GetChildren() returns a read only table, so "child" is a read only table.
2) You never called VirusNameScan().
3) When using if statements with multiple variables, you must do (example) if child.Name == "troll" or child.Name == "virus" then
, you did if child.Name == "virus" or "troll"
.
Here is the fixed version of VirusNameScan()
local suspiciousNames = {"virus", "troll", "YOUR AN IDIOT"} --add any suspicious names to this table function isSuspicious(name) if string.lower(table.concat(suspiciousNames, ' ')):match(name:lower()) then return true end return false end function VirusNameScan() for i, child in pairs(game.Workspace:children()) do if isSuspicious(child.Name) then child:destroy() end end end VirusNameScan()
I added a function so you can just add names to a table. That should work.
Please upvote!