Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

.Changed event firing twice?

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

✓ Accepted answer

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)

2 comments

0

WOW thank you! XD I can't believe I didn't think of this LOL

0

yup yup, can you mark this as the solution if it solved your question?

This discussion is preserved as it was. New answers, comments, and votes are closed.