Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Why is my anti virus plugin not working?

Asked by 9 years ago

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!

1 answer

Log in to vote
1
Answered by 9 years ago

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!

0
It is stiil stuck on scanning for names... my script is what you said. TroytheDestroyer 75 — 9y
0
Did you call the function? bobafett3544 198 — 9y
0
I made a typo. I misspelled match. bobafett3544 198 — 9y
0
I put lines 01-10 of my script and changed the rest to yours. TroytheDestroyer 75 — 9y
View all comments (5 more)
0
Yeah lol. I thought you knew that. I mean like, there was no syntax for anything plugin-wise. bobafett3544 198 — 9y
0
still the same problem, its stuck on "scanning for names...". TroytheDestroyer 75 — 9y
0
I'll try making my own then give you the script. Just pls upvote. bobafett3544 198 — 9y
0
ok. TroytheDestroyer 75 — 9y
0
Name detection is one of the weakest detection anti-viruses can have ViviTheLuaKing 103 — 4y
Ad

Answer this question