Im trying to create a day night cycle and for it i tried creating a system which changes the outdoor ambient color depending on the time of day. Problem is, the value doesn’t stop at the specified color, and so it just goes up nonstop. I tried to change it to linear, and also tried making it “in” rather than “out”, but to no avail.
How can i make it stop at the specified value?
local lighting = game:GetService"Lighting"
local minutes = 360 -- our starting time
while true do
lighting:SetMinutesAfterMidnight(minutes)
minutes += 1
if lighting.ClockTime == 6.5 then
local Tween = game:GetService("TweenService"):Create(lighting, TweenInfo.new(30, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0), {OutdoorAmbient == Color3.new(165, 96, 0)})Tween:Play()
elseif lighting.ClockTime == 8 then
local Tween = game:GetService("TweenService"):Create(lighting, TweenInfo.new(30, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0), {OutdoorAmbient = Color3.new(0.0941176, 0.113725, 0.372549)})Tween:Play()
elseif lighting.ClockTime == 9 then
local Tween = game:GetService("TweenService"):Create(lighting, TweenInfo.new(30, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0), {OutdoorAmbient = Color3.new(70,70,70)})Tween:Play()
end
wait(.5) --how long till a minute passes
end