So I have a street light that I want to turn on and off at certain times but it's not really working. I have made a simple day and night script that increases the Lightings TimeOfDay by 1. Anyways, this Street Light never goes on. By default it is turned off. Here is the code I got so far. The output has shown nothing wrong with it.
local Lightime = script.Parent.PointLight.Enabled
function Daynight(hit)
if game.Lighting.TimeOfDay >= 18
then
if Lightime == false then
Lightime = true
elseif
game.Lighting.TimeOfDay >= 6 then
if Lightime == true then
Lightime = false
end
end
end
end
Should I just add a loop so it is constantly checking or what?

2 comments
Woops, ignore the (hit) in the function. Not sure why I put that there but it has been removed.
Woops I also just realized I never called the function. Anyways, I am not sure what I would use to call it anyways.