| |
|
| |
|
| | local Lighting = game:GetService("Lighting")
|
| | local TweenService = game:GetService("TweenService")
|
| |
|
| |
|
| | local CYCLE_SPEED = 1
|
| | local MINUTES_PER_CYCLE = 20
|
| |
|
| |
|
| | local Presets = {
|
| | Dawn = {
|
| | ClockTime = 6,
|
| | Ambient = Color3.fromRGB(140, 120, 100),
|
| | OutdoorAmbient = Color3.fromRGB(120, 100, 80),
|
| | Brightness = 1,
|
| | FogColor = Color3.fromRGB(200, 170, 140),
|
| | FogEnd = 1500,
|
| | },
|
| | Day = {
|
| | ClockTime = 12,
|
| | Ambient = Color3.fromRGB(150, 150, 150),
|
| | OutdoorAmbient = Color3.fromRGB(140, 140, 140),
|
| | Brightness = 2,
|
| | FogColor = Color3.fromRGB(200, 210, 220),
|
| | FogEnd = 2000,
|
| | },
|
| | Dusk = {
|
| | ClockTime = 18,
|
| | Ambient = Color3.fromRGB(150, 100, 80),
|
| | OutdoorAmbient = Color3.fromRGB(130, 90, 70),
|
| | Brightness = 1,
|
| | FogColor = Color3.fromRGB(200, 140, 100),
|
| | FogEnd = 1200,
|
| | },
|
| | Night = {
|
| | ClockTime = 0,
|
| | Ambient = Color3.fromRGB(50, 50, 70),
|
| | OutdoorAmbient = Color3.fromRGB(30, 30, 50),
|
| | Brightness = 0,
|
| | FogColor = Color3.fromRGB(40, 40, 60),
|
| | FogEnd = 800,
|
| | },
|
| | }
|
| |
|
| |
|
| | Lighting.ClockTime = 6
|
| | Lighting.GeographicLatitude = 40
|
| | Lighting.GlobalShadows = true
|
| |
|
| |
|
| | local atmosphere = Instance.new("Atmosphere")
|
| | atmosphere.Density = 0.3
|
| | atmosphere.Offset = 0.25
|
| | atmosphere.Color = Color3.fromRGB(199, 199, 199)
|
| | atmosphere.Decay = Color3.fromRGB(92, 60, 13)
|
| | atmosphere.Glare = 0
|
| | atmosphere.Haze = 1
|
| | atmosphere.Parent = Lighting
|
| |
|
| |
|
| | local sky = Instance.new("Sky")
|
| | sky.SunAngularSize = 11
|
| | sky.MoonAngularSize = 9
|
| | sky.Parent = Lighting
|
| |
|
| |
|
| | local bloom = Instance.new("BloomEffect")
|
| | bloom.Intensity = 0.2
|
| | bloom.Size = 24
|
| | bloom.Threshold = 0.9
|
| | bloom.Parent = Lighting
|
| |
|
| |
|
| | local colorCorrection = Instance.new("ColorCorrectionEffect")
|
| | colorCorrection.Brightness = 0
|
| | colorCorrection.Contrast = 0.1
|
| | colorCorrection.Saturation = 0.15
|
| | colorCorrection.TintColor = Color3.new(1, 1, 1)
|
| | colorCorrection.Parent = Lighting
|
| |
|
| |
|
| | local sunRays = Instance.new("SunRaysEffect")
|
| | sunRays.Intensity = 0.05
|
| | sunRays.Spread = 0.5
|
| | sunRays.Parent = Lighting
|
| |
|
| |
|
| | local cycleStep = (24 / (MINUTES_PER_CYCLE * 60)) * CYCLE_SPEED
|
| |
|
| | task.spawn(function()
|
| | while true do
|
| | Lighting.ClockTime = (Lighting.ClockTime + cycleStep) % 24
|
| |
|
| |
|
| | local time = Lighting.ClockTime
|
| |
|
| | if time >= 5 and time < 7 then
|
| |
|
| | local t = (time - 5) / 2
|
| | colorCorrection.TintColor = Color3.new(1, 0.9 + t * 0.1, 0.85 + t * 0.15)
|
| | sunRays.Intensity = 0.02 + t * 0.06
|
| | elseif time >= 7 and time < 17 then
|
| |
|
| | colorCorrection.TintColor = Color3.new(1, 1, 1)
|
| | sunRays.Intensity = 0.05
|
| | elseif time >= 17 and time < 19 then
|
| |
|
| | local t = (time - 17) / 2
|
| | colorCorrection.TintColor = Color3.new(1, 0.95 - t * 0.1, 0.9 - t * 0.2)
|
| | sunRays.Intensity = 0.08 - t * 0.06
|
| | else
|
| |
|
| | colorCorrection.TintColor = Color3.new(0.8, 0.8, 0.95)
|
| | sunRays.Intensity = 0
|
| | end
|
| |
|
| | task.wait(1)
|
| | end
|
| | end)
|
| |
|
| | print("Day/Night cycle started")
|
| |
|