I'm trying to script a window that illuminates at night, I'm trying to make it so that math randomizes every day so that every night the window has a chance of illuminating or not, instead of staying on or off every single night for the rest of the game. It seems that that math and day works but the night section does not seem to work.
local window = script.Parent
local pointlight = window.Material
while true do
wait(1)
if game.Lighting:GetMinutesAfterMidnight() > 7 * 60 and game.Lighting:GetMinutesAfterMidnight() < 8 * 60 then
local math = math.random(3,4)
print(math)
end
if game.Lighting:GetMinutesAfterMidnight() > 6 * 60 then
print("day")
window.Material = Enum.Material.Glass
window.BrickColor = BrickColor.new("Black")
window.Transparency = 0
end
if game.Lighting:GetMinutesAfterMidnight() > 18 * 60 and math ==3 then
print("night")
window.Material = Enum.Material.Neon
window.BrickColor = BrickColor.new("Institutional white")
window.Transparency = 0.1
end
end
