Help tweening the "FogEnd" value of Lighting

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

local tweenInfo = TweenInfo.new(3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)

local randomFog = Random.new(1)

while true do
    local FogNum = randomFog:NextInteger(50, 600)
    local tween = TweenService:Create(Lighting, tweenInfo, {FogEnd = FogNum})
    tween:Play()
    wait(10)
end

I attempted tweening the “FogEnd” value to a random value every 10 seconds in a while loop, the script outputs no error but in-game it gives no absolute effect. Does anyone know how to fix it?

1 Like

Replace FogNum with this:

local FogNum = Random.new():NextInteger(50, 600)

The loop actually works, but the reason it’s “not” doing anything is because FogNum returns the same exact value every single time (that value is 579).

I believe this is because Random.new() can take in a specific seed as it’s first parameter. You are forcing it to pick a single seed (which is 1).

Alright, I managed to get it working now, still thank you for the support!
https://medal.tv/games/roblox/clips/s1cHC4xv8M-y_/d1337pRB7Na9?invite=cr-MSxpTWEsNTYzOTQwOSw