while wait(1)do
if game.Lighting.ClockTime >= 20 and game.Lighting.ClockTime <= 7 then
script.Parent.SpotLight.Enabled = true
print("light on")
else
script.Parent.SpotLight.Enabled = false
print("light off")
end
end
I've tested it on local scripts and tried different variations of it. I get the prints but the light doesn't work. Yes, the script is committed.

2 comments
The ClockTime cannot be greater than 20 and less than 7 at the same time
i think you may want to replace the "and" with an "or"