Any recent updates that could have broke this code? This has worked for the past like two weeks and today it just suddenly does not work anymore and I am not sure why. Can anyone explain why this doesn't wok or how to fix it? It's just a script in the Workspace that makes the place darker as night comes and brighter as day arrives:

local l = game:service("Lighting")

while true do
	wait()
	if l.TimeOfDay == "17:50:00" then
		l.Ambient = Color3.new(55/255, 55/255, 55/255)
		l.OutdoorAmbient = Color3.new(90/255, 90/255, 90/255)
	elseif l.TimeOfDay == "18:45:00" then
		l.Ambient = Color3.new(0/255, 0/255, 0/255)
		l.OutdoorAmbient = Color3.new(24/255, 24/255, 24/255)
	elseif l.TimeOfDay == "05:35:00" then
		l.Ambient = Color3.new(55/255, 55/255, 55/255)
		l.OutdoorAmbient = Color3.new(90/255, 90/255, 90/255)
	elseif l.TimeOfDay == "06:25:00" then
		l.Ambient = Color3.new(126/255, 126/255, 126/255)
		l.OutdoorAmbient = Color3.new(182/255, 182/255, 182/255)
	end
end

4 comments

0

you should try each part in the command bar without the if statements

0

They made changes to lighting a little bit ago. I cannot say exactly what they were though. I see if I can find something.

0

Make sure you don't define "l" anywhere else in the script. In general though, I'd change l to "Lighting" (use Ctrl + H in Roblox Studio). Also, maybe try using :GetService("Lighting") rather than :service

0

Nevermind I got it, thanks guys :D I altered some stuff in the script that changed the time of day it seems so the time of day never actually got any of those numbers lol