Day/Night Ambience Scaling

  1. What i’m trying to achieve
    I’m currently making a day/night system for one of my projects and after finishing tempature scaling and whatnot i’m moving onto making the ambience scale with ClockTime alot like this

  1. What is the issue?
    I don’t know fully how to pull this off and previous attempts have failed
	print(game.Lighting.Ambient.R .. "Normal/UnMath'd")
	print(game.Lighting.Ambient.R * game.Lighting.ClockTime/4 .. "Math'd")
	
	game.Lighting.Ambient = Color3.fromRGB(game.Lighting.Ambient.R * game.Lighting.ClockTime/4,game.Lighting.Ambient.G * game.Lighting.ClockTime/4,game.Lighting.Ambient.B * game.Lighting.ClockTime/4)

image

  1. What solutions have you tried so far?

I’ve tried looking at posts on the devforum and most wouldn’t really fit with the script like this one.

I used up my whole brain to come up with a solution for your problem. I’m sure there are different ways of doing this, but I came up with this formula. Hope it helps!

local clockTime = game.Lighting.ClockTime

local color3valueR = 129-(math.abs(clockTime-12)/12*129)
local color3valueG = 129-(math.abs(clockTime-12)/12*129)
local color3valueB = 40-(math.abs(clockTime-12)/12*40)

game.Lighting.Ambient = Color3.fromRGB(color3valueR, color3valueG, color3valueB)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.