How to change lighting based on time (ambient)

hello everyone, I am currently experimenting in studio, but i cant seem to be able to change the lighting color,

im using a while loop, so overtime the ambient changes, my script doesnt seem to work right, anyone have any ideas? (i cant ss the script on my pc)

i already defined lighting and ambedient also added the loop, but cant seem to find the color change

if someone can provide a script example that would be great!

local time = game.Lighting.ClockTime
while true do
if time == 10 then -- change the 10 to whatever time you want
game.Lighting.Ambient = 0,0,0 -- again whatever number value
end
end

just off the top of my head, so im not sure if this will work, but it should. also make it a server script in ServerScriptService

2 Likes