Fog Tween Issue

Me again aaaaaa

Ok so like I’m currently trying to get a bit of a fog system running, right? I am able to change the fog to some settings, however attempting to change it back to it’s default settings ends up with it just making the screen turn completely white.

Keep it in mind that the view is locked into first person.

Unlike my last issue, there isn’t any error message to base this off of, just the code itself.

local TweenS = game:GetService("TweenService")
local Lighting = game.Lighting

local TweenInf = TweenInfo.new(0.05, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)

local Finish = {FogStart=0, FogEnd=100000,FogColor=Color3.new(192, 192, 192)}

local FogTween = TweenS:Create(Lighting, TweenInf, Finish)

So, any ideas on what caused the issue? My assumption is that it has something to do with the Finish variable, but I’m not too sure.

1 Like

I think you should use a repeat until loop. Like this:

local lighting = game:GetService("Lighting")

repeat
    lighting.FogEnd = lighting.FogEnd - 1
until lighting.FogEnd == 500

oh my bad I put the wrong code lol

For the most part, your code looks alright as long as you have played FogTween. If you haven’t, you can just add FogTween:Play() on the next line.

oh yeah it plays FogTween right after the info is given.

1 Like

yeah my bad the actual issue comes from the line

local Finish = {FogStart=0, FogEnd=100000,FogColor=Color3.new(192, 192, 192)}

but how to fix the issue is the question.

1 Like

I just tried using the FogColor you entered in the Finish variable, change Color3.new to Color3.fromRGB.

aka:

local Finish = {
	FogStart = 0, 
	FogEnd = 100_000, 
	FogColor = Color3.fromRGB(192, 192, 192)
}
2 Likes

o h

I am stupid and also maybe ever so slightly dumb for forgetting that you have to do Color3.fromRGB

1 Like

yep, problem solved. thanks for the help lol

2 Likes