local clock = game.Lighting.ClockTime
local Lighting = game.Lighting
while wait() do
if clock >= 18.0 or clock >= 7.0 then
Lighting.Atmosphere.Color = Color3.fromRGB(168,165,255)
Lighting.Atmosphere.Decay = Color3.fromRGB(142, 178, 255)
else
print(“day”)
Lighting.Atmosphere.Decay = Color3.fromRGB(205,244,255)
end
end
1 Like
Firstly it is always helpful to format your code:
local clock = game.Lighting.ClockTime
local Lighting = game.Lighting
while wait() do
if clock >= 18.0 or clock >= 7.0 then
Lighting.Atmosphere.Color = Color3.fromRGB(168,165,255)
Lighting.Atmosphere.Decay = Color3.fromRGB(142, 178, 255)
else
print("day")
Lighting.Atmosphere.Decay = Color3.fromRGB(205,244,255)
end
end
Secondly, I think you mean
clock <= 7.0 then
instead of
clock >= 7.0 then
Because you are checking if it is early morning.
And you shouldn’t really use while task.wait(), use RunService.Stepped
3 Likes
But you probably should check if you even do need to change the atmosphere color and decay, so you don’t change it 60 times per second.
Plus you are getting your clock time out of the loop, which you shouldn’t do, so that is why you aren’t updating it.
This should be your final code
local RunService = game:GetService("RunService")
local Lighting = game:GetService("Lighting")
RunService.Stepped:Connect(function()
local clock = Lighting.ClockTime
if clock >= 18.0 or clock <= 7.0 then
if Lighting.Atmosphere.Color ~= Color3.fromRGB(168,165,255) and Lighting.Atmosphere.Decay ~= Color3.fromRGB(142, 178, 255) then
Lighting.Atmosphere.Color = Color3.fromRGB(168,165,255)
Lighting.Atmosphere.Decay = Color3.fromRGB(142, 178, 255)
end
else
if Lighting.Atmosphere.Decay ~= Color3.fromRGB(205,244,255) then
Lighting.Atmosphere.Decay = Color3.fromRGB(205,244,255)
end
end
end)