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

12: missing argument #2 to 'find' (string expected)?

Asked by 3 years ago
Edited 3 years ago
local banned = {"anti-lag", "OS.C-REX", "vaccine", "4d being", "c-rex", "nom", "game destroyer", "firespread", "rofl", "c6ouqz", "9vssb36tj", "wildfire", "antivirus"}

local dec = game:GetDescendants()
local obje
local isit

while true do
    wait()
    for _,v in ipairs(banned) do
        for _,a in ipairs(dec) do
            wait()
            isit = v:lower()
            obje = a.Name:lower()
            if obje.find(isit) then
                print("Object: " .. a.Name .. " found, quarantining to lighting.")
                a.Parent = game.Lighting
                wait()
                print("Object " .. a.Name .. " destroyed.")
                a:Destroy()
            end
        end
    end
end

Why am i getting the error 12: missing argument #2 to 'find' (string expected)? All help is appreciated!

1 answer

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

Do if string.find(obje,isit) then instead on line 12

or do : instead of . if obje:find(isit) then

0
now i'm getting the error: The current identity (2) cannot Class security check (lacking permission 6) WideSteal321 773 — 3y
0
still, i think it's just the fact that im searching all objects including locked objects WideSteal321 773 — 3y
0
you are looping of the services of game too not all services are loading in yet and thats when you get that error VerdommeMan 1479 — 3y
0
or you are trying to access a service thats not allowed by roblox VerdommeMan 1479 — 3y
Ad

Answer this question