Advertisement
ScriptTyron

Advanaced Day/Night Cycle - Roblox Tutorials

Oct 22nd, 2017
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.45 KB | None | 0 0
  1. --Scripted By: EG3SC11
  2. --Credits to: EG3SC11
  3.  
  4. local util = require(2246630385)
  5.  
  6. local speed = 2.5
  7.  
  8. local I = game.Lighting
  9.  
  10. --Colors
  11. local black = util.Color(0, 0, 0)
  12. local lightBlack = util.Color(0, 0, 0)
  13. local red = util.Color(71, 51, 51)
  14. local orange = util.Color(71, 71, 51)
  15. local pink = util.Color(91, 71, 71)
  16. local grey = util.Color(192, 192, 192)
  17.  
  18. --Fog Levels
  19. local highStart = 0
  20. local highEnd = 300
  21. local mediumStart = 0
  22. local mediumEnd = 600
  23. local lowStart = 0
  24. local lowEnd = 1200
  25.  
  26. I.FogColor = grey
  27. I.FogStart = mediumStart
  28. I.FogEnd = mediumEnd
  29. I.TimeOfDay = "06:00:00"
  30.  
  31. function set(val)
  32.     I:SetMinutesAfterMidnight(val)
  33. end
  34.  
  35. function get(val)
  36.     return I:GetMinutesAfterMidnight()
  37. end
  38.  
  39. while true do
  40.     wait(1/speed)
  41.     set(get() + 1)
  42.     local t = get()
  43.     if t == 0 or t == 1440 or t == 1200 or t == 240 then
  44.         I.FogColor = black
  45.         I.FogStart = highStart
  46.         I.FogEnd = highEnd
  47.     elseif t == 330 or t == 1110 then
  48.         I.FogColor = lightBlack
  49.         I.FogStar = mediumStart
  50.         I.FogEnd= mediumEnd
  51.     elseif t == 345 or t == 1095 then
  52.         I.FogColor = red
  53.         I.FogStart = lowStart
  54.         I.FogEnd = lowEnd
  55.     elseif t == 360 or t == 1080 then
  56.         I.FogColor = orange
  57.         I.FogStart = lowStart
  58.         I.FogEnd = lowEnd
  59.     elseif t == 375 or t == 1065 then
  60.         I.FogColor = pink
  61.         I.FogStart = lowStart
  62.         I.FogEnd = lowEnd
  63.     elseif t == 390 or t == 720 or t == 1050 then
  64.         I.FogColor = grey
  65.         I.FogStart = mediumStart
  66.         I.FogEnd = mediumEnd
  67.     end
  68. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement