Advertisement
Baldeagle22

skrum

Sep 26th, 2018
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. l=game.Lighting
  2.  
  3. cycletime=1*2
  4. rate=10/30
  5.  
  6. --marker is in hours and outside is 1-255
  7. points={
  8. {marker=0,outside=0,amb=0,bright=0,fog=Vector3.new(0,0,0)},
  9. {marker=3,outside=0,amb=0,bright=.5,fog=Vector3.new(0,0,0)},
  10. {marker=5.5,outside=40,amb=0,bright=.6,fog=Vector3.new(0,0,0)},
  11. {marker=6.5,outside=130,amb=0,bright=.7,fog=Vector3.new(130,158,170)}, --190,230,230 --130,158,170
  12. {marker=10,outside=180,amb=10,bright=1,fog=Vector3.new(160,178,190)}, --220,255,255 --160,178,190
  13. {marker=14,outside=180,amb=10,bright=1,fog=Vector3.new(160,178,190)},
  14. {marker=17.5,outside=130,amb=0,bright=.7,fog=Vector3.new(130,158,170)},
  15. {marker=18.3,outside=40,amb=0,bright=.6,fog=Vector3.new(0,0,0)},
  16. {marker=21,outside=0,amb=0,bright=.5,fog=Vector3.new(0,0,0)},
  17. {marker=24,outside=0,amb=0,bright=0,fog=Vector3.new(0,0,0)},
  18. }
  19.  
  20. while true do
  21. wait(rate)
  22.  
  23. local daypercent=(tick()%cycletime)/cycletime
  24. local thetime=(24*daypercent)%24
  25. local hour=math.floor(thetime)
  26. local minute=(thetime-hour)*60
  27. local fminute=math.floor(minute)
  28. local fsecond=math.floor((minute-fminute)*60)
  29. l.TimeOfDay=tostring(hour)..":"..tostring(fminute)..":"..tostring(fsecond)
  30.  
  31. local currentpoints={}
  32. for _,v in pairs(points) do
  33. if v.marker<thetime then
  34. currentpoints[1]=v
  35. else
  36. currentpoints[2]=v
  37. break
  38. end
  39. end
  40. if currentpoints[2]==nil then
  41. print("Problem, no next point.",thetime)
  42. currentpoints[1]=points[1]
  43. currentpoints[2]=points[2]
  44. end
  45. local pointpercent=(thetime-currentpoints[1].marker)/(currentpoints[2].marker-currentpoints[1].marker)
  46.  
  47. local wave=1-((math.cos(math.pi*pointpercent)+1)*.5)
  48.  
  49. local outsideclr=(currentpoints[1].outside+((currentpoints[2].outside-currentpoints[1].outside)*wave))/255
  50. l.OutdoorAmbient=Color3.new(outsideclr,outsideclr,outsideclr)
  51.  
  52. local ambclr=(currentpoints[1].amb+((currentpoints[2].amb-currentpoints[1].amb)*wave))/255
  53. l.Ambient=Color3.new(ambclr,ambclr,ambclr)
  54.  
  55. l.Brightness=currentpoints[1].bright+((currentpoints[2].bright-currentpoints[1].bright)*wave)
  56.  
  57. local fogclr=(currentpoints[1].fog+((currentpoints[2].fog-currentpoints[1].fog)*wave))*(1/255)
  58. l.FogColor=Color3.new(fogclr.x,fogclr.y,fogclr.z)
  59.  
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement