Загрузка данных


-- Day/Night Cycle
-- ServerScriptService -> Script

local Lighting = game:GetService("Lighting")

local CYCLE_LENGTH = 2 * 60 * 60 -- 2 hours

local START_TIME = 6 -- 06:00

local elapsed = 0

while true do
	local deltaTime = task.wait(1)

	elapsed += deltaTime

	if elapsed >= CYCLE_LENGTH then
		elapsed = elapsed - CYCLE_LENGTH
	end

	-- 24 hours in 2 real hours
	local gameTime = (elapsed / CYCLE_LENGTH) * 24
	local clockTime = (START_TIME + gameTime) % 24

	Lighting.ClockTime = clockTime
end