Smooth Day and Night Cycle for Maps thumbnail
0 views0 copies0 likes

Smooth Day and Night Cycle for Maps

Universal script

Copy it, then test it in your own Studio place.

Utilities Verified

Script code

9 lines · 0.3 KB
Download
local Lighting = game:GetService("Lighting")local realSecondsPerDay = 240local began = workspace:GetServerTimeNow()local firstHour = 7while true do	local elapsed = workspace:GetServerTimeNow() - began	Lighting.ClockTime = (firstHour + elapsed * 24 / realSecondsPerDay) % 24	task.wait(0.25)end

About this script

Add this server Script to cycle Lighting.ClockTime across a complete day every four minutes. It measures elapsed server time instead of adding a fixed amount each frame, so scheduler delays do not slow the cycle. Begin at morning, then test sunrise and sunset while your usual lighting effects are active. Tune realSecondsPerDay independently of your round length.

Comments

Share what works, ask questions, or report an issue.

0

Log in to leave a comment.

No comments yet

Be the first to share your thoughts!

Raw Luau source

local Lighting = game:GetService("Lighting")
local realSecondsPerDay = 240
local began = workspace:GetServerTimeNow()
local firstHour = 7
while true do
	local elapsed = workspace:GetServerTimeNow() - began
	Lighting.ClockTime = (firstHour + elapsed * 24 / realSecondsPerDay) % 24
	task.wait(0.25)
end