I've been attempting this for a while. I am making a rather "spooky" game and am trying to make a storyline to where you are in a land where the sky is "cursed" and is always night time. So basically, I've got the code somewhat set up, I'm just trying to find the right number for the minutesAfterMidnight command.
local timeOfDay = minutesAfterMidnight minutesAfterMidnight = 1439 print("variable works") --just for debugging while true do minutesAfterMidnight = minutesAfterMidnight + 1 game.Lighting:SetMinutesAfterMidnight(minutesAfterMidnight) timeOfDay = minutesAfterMidnight wait(.1) print("time of day works") --also for debugging if timeOfDay < 361 and timeOfDay > 359 then minutesAfterMidnight = 1439 end print("if statement works") --once again for debugging end
Again, if someone could either help me with the code and/or find the right number for the time of day, that would be awesome.
So basically, what you want is you want to cycle through nightime, but instead of going into daytime, you want to continue cycling through nighttime?
I would accomplish this by adding something like this to your script:
local maxTime = --Set this to whatever you decide, whatever value minutesAfterMidnight is when you stop. local minTime = --Set this to be the beginning time of your night cycle while true do --Add this to the existing while loop instead of creating another print(minutesAfterMidnight) --Run the script and find when you want the cycle to stop, this should give you the exact time you want. Use this to find the value for maxTime on your own. do
And then basically what I would do after that is once you reach the maximum time you want, start subtracting from minutesAfterMidnight instead of adding. Then when you reach the minimum, start adding. And repeat.
you dont need a code to always have night time, u can just set the time in lighting