Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- l=game.Lighting
- cycletime=1*2
- rate=10/30
- --marker is in hours and outside is 1-255
- points={
- {marker=0,outside=0,amb=0,bright=0,fog=Vector3.new(0,0,0)},
- {marker=3,outside=0,amb=0,bright=.5,fog=Vector3.new(0,0,0)},
- {marker=5.5,outside=40,amb=0,bright=.6,fog=Vector3.new(0,0,0)},
- {marker=6.5,outside=130,amb=0,bright=.7,fog=Vector3.new(130,158,170)}, --190,230,230 --130,158,170
- {marker=10,outside=180,amb=10,bright=1,fog=Vector3.new(160,178,190)}, --220,255,255 --160,178,190
- {marker=14,outside=180,amb=10,bright=1,fog=Vector3.new(160,178,190)},
- {marker=17.5,outside=130,amb=0,bright=.7,fog=Vector3.new(130,158,170)},
- {marker=18.3,outside=40,amb=0,bright=.6,fog=Vector3.new(0,0,0)},
- {marker=21,outside=0,amb=0,bright=.5,fog=Vector3.new(0,0,0)},
- {marker=24,outside=0,amb=0,bright=0,fog=Vector3.new(0,0,0)},
- }
- while true do
- wait(rate)
- local daypercent=(tick()%cycletime)/cycletime
- local thetime=(24*daypercent)%24
- local hour=math.floor(thetime)
- local minute=(thetime-hour)*60
- local fminute=math.floor(minute)
- local fsecond=math.floor((minute-fminute)*60)
- l.TimeOfDay=tostring(hour)..":"..tostring(fminute)..":"..tostring(fsecond)
- local currentpoints={}
- for _,v in pairs(points) do
- if v.marker<thetime then
- currentpoints[1]=v
- else
- currentpoints[2]=v
- break
- end
- end
- if currentpoints[2]==nil then
- print("Problem, no next point.",thetime)
- currentpoints[1]=points[1]
- currentpoints[2]=points[2]
- end
- local pointpercent=(thetime-currentpoints[1].marker)/(currentpoints[2].marker-currentpoints[1].marker)
- local wave=1-((math.cos(math.pi*pointpercent)+1)*.5)
- local outsideclr=(currentpoints[1].outside+((currentpoints[2].outside-currentpoints[1].outside)*wave))/255
- l.OutdoorAmbient=Color3.new(outsideclr,outsideclr,outsideclr)
- local ambclr=(currentpoints[1].amb+((currentpoints[2].amb-currentpoints[1].amb)*wave))/255
- l.Ambient=Color3.new(ambclr,ambclr,ambclr)
- l.Brightness=currentpoints[1].bright+((currentpoints[2].bright-currentpoints[1].bright)*wave)
- local fogclr=(currentpoints[1].fog+((currentpoints[2].fog-currentpoints[1].fog)*wave))*(1/255)
- l.FogColor=Color3.new(fogclr.x,fogclr.y,fogclr.z)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement