while true do game.Lighting.TimeOfDay = ("12:00:00") game.Workspace:GetChildren("PointLight").Enabled = false wait(5) game.Lighting.TimeOfDay = ("01:00:00") game.Workspace:GetChildren("PointLight").Enabled = true wait(5) end
Any parts that have PointLight shall be enabled at 01:00:00 not 12:00:00.
You could use a simple recursive loop.
function toggleLights(state) local lights={} local function recurse(p) for i,v in next, p:GetChildren() do if #v:GetChildren() > 0 then recurse(v) end if v:IsA("PointLight") then v.Enabled=state end end end recurse(workspace) end while true do game.Lighting.TimeOfDay = ("12:00:00") toggleLights(false) wait(5) game.Lighting.TimeOfDay = ("01:00:00") toggleLights(true) wait(5) end
(Tell me if this doesn't work, I just quickly wrote this up)