So i am working on a game and noticed the day night system was kind of messed up. The script functioned fine, it changed the time of day, it's just the graphics looked awful. So i'm working on a script to fix this. For the life of me I can't figure out how to detect if Clocktime is in between the values. Im a amuture scripter by the way :P
here is the code:
--This is the day night fix. Makes the night time look better.
--Vars--
local Lighting = game.Lighting
local DayRange = NumberRange(4.3, 18.15)
--Script--
while true do
if Lighting >= DayRange.Min and Value <= DayRange.Max then
while true do
Lighting.Ambient = Color3.new(game.ServerScriptService.DayNightSystem.Day.Amb)
Lighting.Brightness = game.ServerScriptService.DayNightSystem.Day.Brightness
Lighting.ColorShift_Top = Color3.new(game.ServerScriptService.DayNightSystem.Day.ColorShiftTop)
Lighting.EnvironmentDiffuseScale = game.ServerScriptService.DayNightSystem.Day.Diffuse
Lighting.OutdoorAmbient = Color3.new(game.ServerScriptService.DayNightSystem.Day.OdAmb)
Lighting.EnvironmentSpecularScale = game.ServerScriptService.DayNightSystem.Day.Specular
wait(0.01)
end
else
while true do
Lighting.Ambient = Color3.new(game.ServerScriptService.DayNightSystem.Night.Amb)
Lighting.Brightness = game.ServerScriptService.DayNightSystem.Night.Brightness
Lighting.ColorShift_Top = Color3.new(game.ServerScriptService.DayNightSystem.Night.ColorShiftTop)
Lighting.EnvironmentDiffuseScale = game.ServerScriptService.DayNightSystem.Night.Diffuse
Lighting.OutdoorAmbient = Color3.new(game.ServerScriptService.DayNightSystem.Night.OdAmb)
Lighting.EnvironmentSpecularScale = game.ServerScriptService.DayNightSystem.Night.Specular
wait(0.01)
end
wait(0.01)
end
wait(0.01)
end
if this needs to be cleaned up please help me out

1 comment
Thanks! Worked perfect!