Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --here Is A Day And Night Cycle For ROBLOX, Put this as a script not a local script, then put it in workspace.
- local minutes = 0
- local hours = 12
- local minutesPerGameDay = script.MinutesPerGameDay.Value
- local minutesPerSecond = (24/minutesPerGameDay)
- local curTime = tick()
- local prevTime
- while wait() do
- prevTime = curTime
- curTime = tick()
- local dt = curTime - prevTime
- minutes = minutes + (minutesPerSecond * dt)
- if minutes >= 60 then
- minutes = minutes - 60
- hours = hours + 1
- if hours >= 24 then
- hours = 0
- end
- end
- game.Lighting.TimeOfDay = hours .. ":" .. math.floor(minutes) .. ":00"
- end
- --If it doesn't work then oof.
Advertisement
Add Comment
Please, Sign In to add comment