Hello! I am having a lot of trouble trying to make this function for my game. I looked around and only found one other dev forum post on this topic, however it did not work for me.
I need help making it so whenever night time begins, a GUI at the top of the screen changes its text. For example, Night 1, Night 2, etc. I will attach some images below, thanks!
do an if statement to detect if it’s night time. If it is not then change the text to “day”
local lighting = game.Lighting
game.Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
if lighting.ClockTime >= 6 and lighting.ClockTime < 18 then
print("It's day!")
end
end)
Test the code and whenever the clock changes to day it will print It’s Day