Is it possible to make dynamic ambient change?

In other games (not roblox) , when you enter a cave or building , your cam gets very dark first and then darkness dissappears after some seconds.

I did a ambient changer. Happens when you touch a part but what Im asking is a ambient changer like :
you touch a part ,
screen gets darker slowly (not instantly) ,
and then brightness rises up slowly (not instantly).

How can I do this ?

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

-- enters cave

TweenService:Create(Lighting, TweenInfo.new(1), {ExposureCompensation = -2}:Play()
TweenService:Create(Lighting, TweenInfo.new(1), {Brightness = 0}:Play()

-- exit cave

TweenService:Create(Lighting, TweenInfo.new(1), {ExposureCompensation = 0}:Play()
TweenService:Create(Lighting, TweenInfo.new(1), {Brightness = 3}:Play()

Tween service basically slowly changes an instances property to a desired amount

like when entering the cave it changes the brightness of Lighting smoothly to 0

2 Likes

Also Im not a professional scripter. “enters cave” part is a trigger place holder such as touch?

Yes, when it touches the cave it should fire that code, just put it inside the function