I want to disable all lights. The hierarchy is simple. Workspace > Facility > Roof Lamp > Light > PointLight.
My script is:
local function turnOffLights()
local roofLamp = game.Workspace.Facility["Roof Lamp"].Light
for i, child in pairs(roofLamp:GetChildren()) do
if child:IsA("PointLight") then
child.Enabled = false
end
end
end
I think it’s supposed to work, but it doesn’t
I’ve did some testing and everything works correctly, it finds the workspace, the folder and then the light. So hierarchy is correct. I really don’t know what is wrong and this is driving me crazy.