Hello everyone,
I'm trying to make a script that will change the ambience and brightness of in-game lighting depending on its ClockTime value but I seem to run into some issues.
This is what I have so far. The script is pretty big, because I want to make transitions smoother.
local ambience = game.Lighting.Ambient
local brightness = game.Lighting.Brightness
while true do
if game.Lighting:GetMinutesAfterMidnight () > 17.8 * 60 then
--game.LightingChanged.Ambient = Color3.fromRGB(154, 99, 15)
print("it's 17:48")
ambience = Color3.fromRGB(154, 99, 15)
brightness = 4
end
if game.Lighting:GetMinutesAfterMidnight () > 19.3 * 60 then
print("it's 19:18")
ambience = Color3.fromRGB(112, 67, 0)
brightness = 0
end
if game.Lighting:GetMinutesAfterMidnight () > 20.6 * 60 then
print("it's 20:36")
ambience = Color3.fromRGB(73, 44, 9)
brightness = 0
end
if game.Lighting:GetMinutesAfterMidnight () > 5 * 60 then
print("it's 05:00")
brightness = 4
end
if game.Lighting:GetMinutesAfterMidnight () > 6.06 * 60 then
print("it's 20:36")
ambience = Color3.fromRGB(151, 110, 49)
brightness = 4
end
if game.Lighting:GetMinutesAfterMidnight () > 6.4 * 60 then
print("it's 20:36")
ambience = Color3.fromRGB(179, 107, 0)
brightness = 4
end
if game.Lighting:GetMinutesAfterMidnight () > 7 * 60 then
print("it's 20:36")
ambience = Color3.fromRGB(204, 132, 21)
brightness = 4
end
end
The output is giving out this error which im not sure what to do with it nor how to fix the issue " Script timeout: exhausted allowed execution time - Server - Ambience:4 "
If any of you could help me I will owe my life to you

2 comments
OMG thank you so much! This makes so such sense now! you saved my day ????????
yes i saved your whole life your kids will work for me for the rest of their days i own your DNA from now your whole family belongs to me