Help or Day/Night Cycle?

Yo. I need help on making a “Day/Night Cycle” but the situation I’m having is, I’m trying to get it into a hour loop. 12 Hours a Day, 12 at Night. Can anyone guide me?

4 Likes

there are a ton of tutorials online you can easily find. Please try to do research about your question before making a post about it

4 Likes

did he just say 12 hours a day, 12 hours at night?

2 Likes

Hello,
ROBLOX themselves have posted tutorials on Day/Night Cycles.

I have found a few, and maybe one of them might help you. Good luck!

1 Like

I was saying like a EST Standard.

Already have, Made the Post so someone can better explain it a little.

If you’re just trying to make in-game time last 24 hours you could get away with something like,

lighting:SetMinutesAfterMidnight(lighting:GetMinutesAfterMidnight() + 1)

every 60 seconds (1 minute).

To try to sync it up with EST you could try using DateTime and convert it to local time or do UTC-5.

1 Like

To make the time in game be the real life est time you could do the following:


while true do
	local estSeconds = os.time() - (3600*5)  -- get 5 hour est offset from utc time (change this if you want time to display in a different hour)
	local estTime = os.date("!*t", estSeconds) -- get utc time with est offset 
	
--set game.lighting based on est time
	game:GetService("Lighting").TimeOfDay = estTime.hour .. ":" .. estTime.min.. ":" .. estTime.sec
	print("Time: " .. game:GetService("Lighting").TimeOfDay)
	wait(1)
end
5 Likes