Help with tweening Fog

Hello, I’m trying to make it where fog tweens but it doesnt work, any help

local TS = game:GetService("TweenService")

local FadeInFog = TS:Create(game.Lighting.FogEnd, TweenInfo.new(0.7, Enum.EasingStyle.Linear), {FogEnd = 50})
local FadeOutFog = TS:Create(game.Lighting.FogEnd, TweenInfo.new(0.7, Enum.EasingStyle.Linear), {FogEnd = 111111111})
1 Like

You need to call :Play() on the variables like FadeInFog:Play()

1 Like

i know but it said an error with cant cast value, and when i type FadeInFog it doesnt give me a autocorrect for Play or stop meaning its wrong

That’s because you’re passing Lighting’s .FogEnd property for the instance argument, use game.Lighting instead of game.Lighting.FogEnd.

You also have to call :Play() on it as @Lorourkethebest said but you might be playing it later in the script.

1 Like

It doesn’t need to give autocorrect for play. When I try to play a sound from the Workspace, for example, it doesn’t autocorrect, I just have to type Play(). That’s how it is for sounds, so unless your trying to “Play()” the wrong thing, I honestly have no idea.

local TS = game:GetService("TweenService")
local Lighting = game:GetService("Lighting")

local FadeInFog = TS:Create(Lighting, TweenInfo.new(0.7, Enum.EasingStyle.Linear), {FogEnd = 50})
local FadeOutFog = TS:Create(Lighting, TweenInfo.new(0.7, Enum.EasingStyle.Linear), {FogEnd = 111111111})

task.wait(3)

FadeInFog:Play()
FadeInFog.Completed:Wait()
FadeOutFog:Play()
FadeOutFog.Completed:Wait()
print("Both tweens played!")