Scripting | Unknown Error

for i,v in pairs(workspace.Lights:GetChildren()) do
    for l,k in pairs(v:GetChildren()) do
        if l.Name == "light" then
            l.Color = Color3.new()
            if l:FindFirstChild("SpotLight") then
                l:FindFirstChild("SpotLight").Enabled = false
            end
        end
    end
end

Hey, so I was working on something, but my script keeps erroring at “If l.Name == “light” then”
The error would say "attempt to index number with ‘Name’ " But it doesnt even show a number, please help!

1 Like

Hey, I am not sure, but wouldn’t it be k.Name?

1 Like

I cannot believe i overlooked that so hard. xD Thank you!

Haha, yes, I was questioning myself too, I almost overlooked that.