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.
