I’m assuming you have a script to change the time progressively, it depends on exactly how time is changing, but you can access the time of day via game.Lighting.ClockTime (which is in military time).
So, maybe you could do a check every couple of seconds or so to see if the ClockTime is within a certain range (as checking for an exact number might not work if it moves in small increments).
As an example:
local weatherState = 0
while true do
local clockTime = Lighting.ClockTime
if (clockTime > 5.5 and clockTime < 6.5) and weatherState ~= 6 then
weatherState = 6
-- do things
end
task.wait(2)
end
This will do an action if the clock time is around 6 AM, though keep in mind you may want to somehow fit this into a function to easily add actions to it. Also, maybe save the current state of weather or whatnot so it doesn’t repeat actions constantly (edited the code snippet to include this kind of functionality)
Don’t use clockTime > 17 and clocktime < 19 because that only checks if it’s within that range.
Use
while task.wait(10) do --you don't need this script to be really precise do you?
if clockTime > 18 then
--set your lighting parameters for night
elseif clockTime > 6
--set your lighting parameters for day
end
end