How does one go about taking this script: --In a server script with fe it works
01 | local getlights = game.Workspace.Lights:GetChildren() |
02 | game:GetService( "RunService" ).RenderStepped:connect( function () |
03 | for i = 1 , #getlights do |
04 | if getlights [ i ] .PointLight.Enabled = = true then |
05 | getlights [ i ] .PointLight.Enabled = false |
06 | print ( "all off" ) |
07 | else |
08 | getlights [ i ] .PointLight.Enabled = true |
09 | print ( "all on" ) |
10 | end |
11 | end |
12 | end ) |
and put it in a local script with fe, So it works in play mode.
Don't see any problem here. However i would recommend using something that looks a bit cleaner, for example:
1 | local getlights = workspace.Lights:GetChildren() |
2 |
3 | game:GetService( "RunService" ).RenderStepped:connect( function () |
4 | for i,v in pairs (getlights) do |
5 | v.PointLight.Enabled = not v.PointLight.Enabled |
6 | end |
7 | end ) |