Unable to access dictionary error

I’m using tweenservice in a day night cycle to switch the lighting settings. Upon tweening them once to the morning settings. The entire day/night cycle stops freezing the time. I get the error which brings me to line 73 of my code.

The 3rd argument of TweenService that you’re passing is supposed to be a dictionary with the key being the property and value being the value you want to reach, and the 1st argument is supposed to be the object where the tween will occur. Here’s a fix:

Replace the for loops with this:

local lightingTween = tweenService:Create(lighting, tweenInfo, lightSetting)
local atmosphereTween = tweenService:Create(atmosphere, tweenInfo, atmosphereSetting)

lightingTween:Play()
atmosphereTween:Play()

You can refer to the TweenService:Create() page on the developer hub. Also, please don’t post screenshots of code instead of using a codeblock, as a codeblock makes the code easier to read and grants the ability to copy your code for whatever you post in the scripting support category