Need help with increasing the atmosphere properties overtime

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

Hello, I’m really new to scripting but I want to make that when the clock time reaches 18 the offset, haze and density changes so it becomes darker

  1. What is the issue? Include screenshots / videos if possible!
    It doesn’t change no matter what I try.

  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried using repeat until but for some reason it doesn’t work. I also tried using while wait.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local offset = game.Lighting.Atmosphere.Offset == 0.25
local haze = game.Lighting.Atmosphere.Haze == 0 
local density = game.Lighting.Atmosphere.Density == 0.3
local ctime = game.Lighting.ClockTime

while wait() do
	if ctime >= 18 then
		repeat 
			offset = offset + 0.00038833333
			haze = haze + 0.01666666666
			density = density + 0.00129166666
			print("working")
			wait(0.6)
		until offset == 0.233
	end
end

1 Like

Does it print “working” on the output?

If not, does it send any error?

The problem is that you are changing the values of local variables, but not the properties of game.Lighting.Atmosphere.

You need to set ‘game.Lighting.Atmosphere.PROPERTY = PROPERTY_NAME’ after changing the variable.

ex.

offset = offset + 0.0038833333
game.Lighting.Atmosphere.Offset = offset

Also, your initial values are set to booleans, not numbers. Remove the == and set the initial offset to either a number or ‘game.Lighting.Atmosphere.Offset’. This also applies to haze and density.

local offset = game.Lighting.Atmosphere.Offset == 0.25
should be

local offset = 0.25
game.Lighting.Atmosphere.Offset = offset

You should use this instead: TweenService | Roblox Creator Documentation