How to make a Day/Night cycle script (Roblox Studio)
Вставка
- Опубліковано 18 бер 2024
- In this video I will tell you guys how to make a Day/Night cycle script.
Script:
local Lighting = game:GetService("Lighting")
local cycleDuration = 300
local startTime = os.time()
game:GetService("RunService").Heartbeat:Connect(function(deltaTime)
local elapsedTime = os.time() - startTime
local timeOfDay = elapsedTime % cycleDuration
Lighting:SetMinutesAfterMidnight(timeOfDay / cycleDuration * 24 * 60)
end)