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

[solved] attempt to index nil with 'lower'?

Asked by 3 years ago
Edited 3 years ago

This code is supposed to destroy any object that is in a table, but, for some reason I get the error attempt to index nil with 'lower'attempt to index nil with 'lower'

local banned = {"baseplate"}

local dec = game:GetDescendants()

while true do
    wait()
    for _,v in ipairs(banned) do
        for _,a in ipairs(dec) do
            wait()
            if a.Name:lower().find(v.Name:lower()) then
                a:Destroy()
            end
        end
    end
end

Anyone know why this happens? Thanks.

Answer this question