I have conducted many tests, but the code does not work, I have changed a few things in the script, but it still does not work, the Output says `18:42:02.523 - local VirusNames = {"Script"} local Viruses = 0
local func:6: attempt to call method 'GetChildren' (a nil value) 18:42:02.524 - Stack Begin 18:42:02.525 - Script 'local VirusNames = {"Script"} local Viruses = 0
local func', Line 6 - upvalue ChkScan 18:42:02.526 - Script 'local VirusNames = {"Script"} local Viruses = 0
local func', Line 12 - local ChkScan 18:42:02.527 - Script 'local VirusNames = {"Script"} local Viruses = 0
local func, Line 16 18:42:02.527 - Stack End`, but, I don't know what I'm doing wrong, here is the script;
local VirusNames = {"Script"}
local Viruses = 0
local function ChkScan(Object)
for i,v in pairs(VirusNames) do
for i,v2 in pairs(Object:GetChildren()) do
pcall(function() local ChkName = v2.Name end)
if v2.Name:lower() == v:lower() then
Viruses = Viruses + 1
end
end
ChkScan(v) --Originally at line 11
end
end
ChkScan(game.Workspace)
print(Viruses)

5 comments
How can I fix this?
I think I found the problem, for both 'for' loops, I used the same 'i', could that of caused the problem?
No, that is not the problem. This shouldn't require nested loops at all. 1st) Compare the name of
Objectto all elements ofVirusNames. Then, do this for all children recursively (loop throughObject:GetChildrenand callChkScanon each child)So, like I change 'ChkScan()' to 'ChkScan(game.Workspace)', 'ChkScan(game.ServerScriptService)', ect., or like 'ChkScan(game.Worksace.Model)'?
Yes