Hey there! I have a bit of a wonky script that is supposed to make the color correction to purple during the nighttime, and regular during daytime. It works for nighttime perfectly, but does not wait until daytime to do the second tween of changing from purple, back to default. Is there anything I should change to achieve this affect?
local CC= game.Lighting.ColorCorrection
local TweenService = game:GetService("TweenService")
while true do
wait(0.1)
if game.Lighting:GetMinutesAfterMidnight() > 16 * 60 then --Checks Nighttime
local TweenAnimation = TweenInfo.new(5, Enum.EasingStyle.Linear)
wait(5)
print("Turn purple")
local tween = TweenService:Create(CC, TweenAnimation, {TintColor = Color3.fromRGB(170, 0, 255)})--Purple nighttime tint
tween:Play()--Tween plays
wait (1)
if game.Lighting:GetMinutesAfterMidnight() > 7 * 60 then--Problem Area
print("Turn not purple")
local tween2 = TweenService:Create(CC,TweenAnimation,{TintColor = Color3.fromRGB(255, 255, 255)})--Default morning lighting
wait (5)
tween2:Play()
print("Tween successfully played")
end
end
end
Edit : Accidentally posted before I could add more details. I labeled the problem area in the script in my notes. Whatever it is that I did, it causes the tweens to loop until around 05:00:00 ingame time whereas I want the second tween to begin at that time to restart the daytime cycle.

1 comment
This works perfectly! Seems about right for me to mess up something so miniscule. Thanks for teaching me something new! Take care!