I have a script that sets the time to 19, and it works, but then this doesn't go through?
if game.Lighting.TimeOfDay == 19 then print("19") end
The reason it is not printing anything is because the if statement is not within a loop. What you can do is use OnChanged()
to detect when the time changes, and when it changes, it checks the TimeOfDay
and sees if it is 19.
game.Lighting.Changed:Connect(function(changedProperty) --Lighting property is changed if game.Lighting.TimeOfDay == 19 then print("19") end end)
Marked as Duplicate by imKirda
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?