skies = { "s1", "s2", "s3"} while true do csky = math.random(1, #skies) wait(0.001) if game.Lighting:GetMinutesAfterMidnight() == 0 then if skies[csky] == "s1" then game.Lighting.Sky.SkyboxBk = "rbxassetid://558861298" game.Lighting.Sky.SkyboxDn = "rbxassetid://558860805" game.Lighting.Sky.SkyboxFt = "rbxassetid://558861465" game.Lighting.Sky.SkyboxLf = "rbxassetid://558860596" game.Lighting.Sky.SkyboxRt = "rbxassetid://558861057" game.Lighting.Sky.SkyboxUp = "rbxassetid://558861628" print("sky1") elseif skies[csky] == "s2" then game.Lighting.Sky.SkyboxBk = "rbxassetid://510033734" game.Lighting.Sky.SkyboxDn = "rbxassetid://510033548" game.Lighting.Sky.SkyboxFt = "rbxassetid://510033858" game.Lighting.Sky.SkyboxLf = "rbxassetid://510033352" game.Lighting.Sky.SkyboxRt = "rbxassetid://510033651" game.Lighting.Sky.SkyboxUp = "rbxassetid://510033905" print("sky2") elseif skies[csky] == "s3" then game.Lighting.Sky.SkyboxBk = "rbxassetid://509678983" game.Lighting.Sky.SkyboxDn = "rbxassetid://509678855" game.Lighting.Sky.SkyboxFt = "rbxassetid://509679034" game.Lighting.Sky.SkyboxLf = "rbxassetid://509678765" game.Lighting.Sky.SkyboxRt = "rbxassetid://509678922" game.Lighting.Sky.SkyboxUp = "rbxassetid://509679076" print("sky3") end end end
Edit: I forgot to mention, the script is in game.Lighting.Sky
Hmm, I think the problem is that it's just missing the point where MinutesAfterMidnight is 0. I'm not 100% sure, but try this:
--Assuming that this is a Server script (which it hopefully is) skies = { "s1", "s2", "s3"} game.Lighting.LightingChanged:connect(function() if game.Lighting:GetMinutesAfterMidnight() == 0 then csky = math.random(1, #skies) if skies[csky] == "s1" then game.Lighting.Sky.SkyboxBk = "rbxassetid://558861298" game.Lighting.Sky.SkyboxDn = "rbxassetid://558860805" game.Lighting.Sky.SkyboxFt = "rbxassetid://558861465" game.Lighting.Sky.SkyboxLf = "rbxassetid://558860596" game.Lighting.Sky.SkyboxRt = "rbxassetid://558861057" game.Lighting.Sky.SkyboxUp = "rbxassetid://558861628" print("sky1") elseif skies[csky] == "s2" then game.Lighting.Sky.SkyboxBk = "rbxassetid://510033734" game.Lighting.Sky.SkyboxDn = "rbxassetid://510033548" game.Lighting.Sky.SkyboxFt = "rbxassetid://510033858" game.Lighting.Sky.SkyboxLf = "rbxassetid://510033352" game.Lighting.Sky.SkyboxRt = "rbxassetid://510033651" game.Lighting.Sky.SkyboxUp = "rbxassetid://510033905" print("sky2") elseif skies[csky] == "s3" then game.Lighting.Sky.SkyboxBk = "rbxassetid://509678983" game.Lighting.Sky.SkyboxDn = "rbxassetid://509678855" game.Lighting.Sky.SkyboxFt = "rbxassetid://509679034" game.Lighting.Sky.SkyboxLf = "rbxassetid://509678765" game.Lighting.Sky.SkyboxRt = "rbxassetid://509678922" game.Lighting.Sky.SkyboxUp = "rbxassetid://509679076" print("sky3") end end end
Lighting has an event which fires every time a property of game.Lighting is changed. As I said, I'm not completely sure it will work, as I personally haven't done much work when it comes to lighting, but try it nonetheless. :)