minutesAfterMidnight = 0 setLights = function() for i,v in next, workspace:GetChildren() do if v:IsA("SpotLight") then v.Enabled = true end end end while true do minutesAfterMidnight = minutesAfterMidnight + 10 game.Lighting:SetMinutesAfterMidnight(minutesAfterMidnight) wait(.1) if game.Lighting.TimeOfDay == "06:00:00" then setLights(false) end if game.Lighting.TimeOfDay == "18:00:00" then setLights(true) end end
wat i have collected from others so far and edited..i have no idea how this works please explain//it is currently not working
You're not taking an argument in your setLights function. Change it to this and maybe it will work.
function SetLightsEnabled(bool) local function GetAllLights(p) local lights = {} for _,v in next, p:GetChildren() do if v:IsA("Light") then table.insert(lights, v) end GetAllLights(v) end end for _,light in next, GetAllLights(workspace) do light.Enabled = bool end end