Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

.Changed event firing twice?

Asked by 2 years ago

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)

1 answer

Log in to vote
1
Answered by 2 years ago

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)
0
WOW thank you! XD I can't believe I didn't think of this LOL xX02Dire_Wolf20Xx 11 — 2y
0
yup yup, can you mark this as the solution if it solved your question? SuperLittleAdmin 257 — 2y
Ad

Answer this question