I’m trying to make a day/night cycle script, where once it turns night, it lowers some values in lighting to make the environment darker, and when it turns day, it raises those values back to normal.
The problem is, these values are not changing, both on server and client, as well and both on studio and normal Roblox. I have been trying to figure out why for the past 2 days and I’m at a dead end, and nobody else here seems to be having this issue, so I’m posting this now for help. Not sure if this is a bug or not, so I’m posting it in scripting help.
I have the code below, and it was originally a function inside one script but I put it inside a separate script in an attempt to see what’s wrong.
local brightness = game.Lighting.Brightness local specular = game.Lighting.EnvironmentSpecularScale local diffuse = game.Lighting.EnvironmentDiffuseScale script.Parent.Audio.Music["AmbientMusic" .. math.random(1,3)]:Play() for i = 1, 100 do brightness = brightness - 0.03 specular = specular - 0.005 diffuse = diffuse - 0.01 task.wait(1) end
I tried using printing to see if the script is actually working, and yes, the script is working perfectly fine. It’s just that the values in lighting are absolutely not changing for some reason.
If anybody has a solution, i would be grateful to hear it. Thanks.