Update: The script works now, the script written below works 100%. If anyone wants a script that gradually changes the OutdoorAmbient and FogColor at different times of the day, the scripter who made this script is asomeman108. He says you are welcome to use it if you need it for your game.
local ambistart = Color3.new(1, 0.922, 0.827)
local ambifinish = Color3.new(0.094, 0.094, 0.094)
local fogcolorstart = Color3.new(0.784, 0.706, 0.569)
local fogcolorfinish = Color3.new(0.082, 0.082, 0.082)
darkout = false
while true do
wait(2)
if game.Lighting.ClockTime >= 17 or game.Lighting.ClockTime <= 6.5 then
if darkout == false then
print("darkening")
for i = 0, 1, 0.00227 do
game.Lighting.OutdoorAmbient = ambistart:Lerp(ambifinish, i)
game.Lighting.FogColor = fogcolorstart:Lerp(fogcolorfinish, i)
wait(0.1)
end
darkout = true
end
elseif game.lighting.ClockTime <= 17 and game.lighting.ClockTime >= 6.5 then
if darkout == true then
print("lightening")
for i = 0, 1, 0.00227 do
game.Lighting.OutdoorAmbient = ambifinish:Lerp(ambistart, i)
game.Lighting.FogColor = fogcolorfinish:Lerp(fogcolorstart, i)
wait(0.1)
end
darkout = false
end
end
end
Why are you using a for loop with 3 decimals anyways? It will always output the same thing if you’re just lerping to decimals. Also, you need to use Color3.fromRGB as that returns the correct Color3 values.
I’m asking why are you using a for loop with 3 decimals. You’re trying to use a for loop to lerp decimals (keep in mind it’s being lerped from a preset value) and it always returns the same thing instead of gradually lerping, like you want.
Also what do you mean by 3 digits? Lerping is always the same, whether it be a CFrame, Vector3, or Color3.
He is asking what the alpha (the i at the end) means. He doesn’t know what the three separate numbers do and thus doesn’t know why he can’t have decimal values.
The first number is the current number you have. The second number is the goal you’re trying to reach. The third number is the value you’re adding/subtracting by.
Color3.new(r, g, b) uses values between 0 and 1 for the R/G/B components. If you want to use values between 0 and 255 instead, use Color3.fromRGB(r, g, b).
Alternatively, continue using Color3.new(r, g, b), but divide the R/G/B values by 255.
Yes it is the problem. If by updated code you mean the code in the OP is updated, you are still using the new constructor with values greater than 1, right at the top of your script.
The fundamental issue of which Color3 constructors you’re using for what purposes needs to be addressed first before you can start isolating any other issues.
If you are using the new constructor, yes, each value must be 0 ≤ n ≤ 1. The values passed to a Color3 object depend on what constructor you are using. If it is new, it is between 0 and 1. Any value higher than that will cause unnaturally high values to be applied. You are using Color3.new with values >1 when you should either be dividing those all by 255 or using fromRGB.
This was explained in the post you replied to and said it’s not the problem. It is the problem.
If anyone needs this script, the scripter who made this, asomeman108, has graciously allowed any who need this to use it. Posted the working script at the top of the page if anyone needs it.
Note if you want to use this script, you should probably tweak the time values and the OutdoorAmbient values. Take the value of the outdoor ambient (should be 3 numbers) and divide each by 255 to replace vals.