Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Help with making a realistic ColorShift_Top color transition as time goes by? [Solved]

So I am making a realistic game, and I want the lighting to smoothly move between colors as the day goes by. Right now, the problem is that it transitions immediately. The effect it creates is also VERY unrealistic (At the first half of night, the color is sunset, at the second half, the color is night). I couldn't figure out how to tween this. Script:

local Lighting = game:GetService("Lighting")
local night, dawn, noon, sunset = 0, 6, 12, 18
local ambients = {
	["Dawn"] = Color3.fromRGB(255, 180, 25),
	["Day"] = Color3.fromRGB(110, 110, 110),
	["Sunset"] = Color3.fromRGB(255, 140, 35),
	["Night"] = Color3.fromRGB(30, 30, 50)
}

local function GetAmbient()
	local ClockTime = Lighting.ClockTime
	if ClockTime >= night and ClockTime <= dawn then
		return ambients.Dawn
	elseif ClockTime >= dawn and ClockTime <= noon then
		return ambients.Day
	elseif ClockTime >= noon and ClockTime <= sunset then
		return ambients.Sunset
	elseif ClockTime >= sunset and ClockTime <= night then
		return ambients.Night
	else
		return ambients.Night
	end
end

while true do
	Lighting.ClockTime = Lighting.ClockTime + 0.1
	local Ambient = GetAmbient()
	print(Ambient)
	Lighting.FogColor = Ambient
	Lighting.ColorShift_Top = Ambient
	wait()
end

Can somebody help me make this more realistic and smooth? :(

CLARITY EDIT: One instance of the issue is that sunset / rise, say, last around 1 hour - 30 minutes. In this, they last half the night XD

1 answer

Ok, it was as simple as a DevForum search. For those interested, here is the post. With slight modifications, I got this to fit my needs.

This discussion is preserved as it was. New answers, comments, and votes are closed.