So I have two Background Music files in the workspace called "SurfaceDay" and "SurfaceNight." I use this script down below.
minutesAfterMidnight = 0 while true do minutesAfterMidnight = minutesAfterMidnight + 10 game.Lighting:SetMinutesAfterMidnight(minutesAfterMidnight) wait(0.1) if game.Lighting:GetMinutesAfterMidnight() > 6 * 60 and minutesAfterMidnight < 17 * 59 then if game.Workspace.SurfaceDay.IsPaused then game.Workspace.SurfaceNight:Stop() game.Workspace.SurfaceDay:Play() end end if game.Lighting:GetMinutesAfterMidnight() > 18 * 00 and minutesAfterMidnight < 6 * 59 then if game.Workspace.SurfaceNight.IsPaused then game.Workspace.SurfaceDay:Stop() game.Workspace.SurfaceNight:Play() end end end
The problem here is that if the time was nighttime, the Night music only plays once when I set it to loop, and if the time was daytime, the Day music played but the Night music never plays. Is there a reason for this problem and how do I fix this?
Thank you.
This should work.
minutesAfterMidnight = 0 while true do minutesAfterMidnight = minutesAfterMidnight + 10 game.Lighting:SetMinutesAfterMidnight(minutesAfterMidnight) wait(0.1) print(minutesAfterMidnight) if minutesAfterMidnight == 6*60 then game.Workspace.SurfaceNight:Stop() game.Workspace.SurfaceDay:Play() end if minutesAfterMidnight == 18*60 then game.Workspace.SurfaceNight:Play() game.Workspace.SurfaceDay:Stop() minutesAfterMidnight = 0 end end