1 | while true do |
2 | game.Lighting.TimeOfDay = ( "12:00:00" ) |
3 | game.Workspace:GetChildren( "PointLight" ).Enabled = false |
4 | wait( 5 ) |
5 | game.Lighting.TimeOfDay = ( "01:00:00" ) |
6 | game.Workspace:GetChildren( "PointLight" ).Enabled = true |
7 | wait( 5 ) |
8 | end |
Any parts that have PointLight shall be enabled at 01:00:00 not 12:00:00.
You could use a simple recursive loop.
01 | function toggleLights(state) |
02 | local lights = { } |
03 | local function recurse(p) |
04 | for i,v in next , p:GetChildren() do |
05 | if #v:GetChildren() > 0 then |
06 | recurse(v) |
07 | end |
08 | if v:IsA( "PointLight" ) then |
09 | v.Enabled = state |
10 | end |
11 | end |
12 | end |
13 | recurse(workspace) |
14 | end |
15 |
(Tell me if this doesn't work, I just quickly wrote this up)