So im trying to make an event that happens whenever a certain time of the day comes, and I'm just testing the .Changed event. Whenever the clocktime changes for some reason the message is printing 2x each time? Also iis there a better way to fire an event when the ClockTime changes?
game.Lighting.Changed:Connect(function() print("time change") end)
This is because Lighing has multiple properties that can change at the same time, such as ClockTime
and TimeOfDay
.
Instead, try using :GetPropertyChangedSignal()
, this would only fire if the property mentioned change, and not all property.
game.Lighting:GetPropertyChangedSignal('ClockTime'):Connect(function() print('ClockTime changed.') end)