Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does the FogColor not change?

Asked by 6 years ago

I'm trying to make a script that changes the FogColor of Lighting when the ClockTime changes, however it produces no errors in the output.

local lighting = game:GetService("Lighting")

lighting.Changed:Connect(function()
    if lighting.ClockTime == 6.4 then
        for i = 1, lighting.FogColor.R do
            lighting.FogColor = lighting.FogColor + Color3.fromRGB(1, 1, 1)
        end
    elseif lighting.ClockTime == 18 then
        for i = 1, lighting.FogColor.R, -1 do
            lighting.FogColor = lighting.FogColor - Color3.fromRGB(1, 1, 1)
        end
    end
end)

Why isn't this working and how can I fix it? Please help!

1 answer

Log in to vote
0
Answered by
GingeyLol 338 Moderation Voter
6 years ago

it should work.

if it doesnt work than it is the RGB coloring part or that everytime a lighting property changes the if statement will run again so depending on how long you make each day in the game the fog lighting will only change when clocktime is at 6.4 and 18

Ad

Answer this question