Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- dayLength defines how long, in minutes, a day in your game is. Feel free to alter it.
- local dayLength = 12
- local daysPassed = 0
- local cycleTime = dayLength*60
- local minutesInADay = 24*60
- local lighting = game:GetService("Lighting")
- local startTime = tick() - (lighting:getMinutesAfterMidnight() / minutesInADay)*cycleTime
- local endTime = startTime + cycleTime
- local timeRatio = minutesInADay / cycleTime
- if dayLength == 0 then
- dayLength = 1
- end
- repeat
- local currentTime = tick()
- if currentTime > endTime then
- startTime = endTime
- endTime = startTime + cycleTime
- --
- daysPassed = daysPassed + 1
- if daysPassed % 3 == 0 then --// every 3 days
- print 'its been 3 days'
- end
- end
- lighting:setMinutesAfterMidnight((currentTime - startTime)*timeRatio)
- wait(1/15)
- until false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement