I'm trying to make a script where it plays one song at day and another at night. But when it becomes night, (I believe) both songs keep interfering with eachother and repeats the night one every 5 seconds from the sunset till the moon is in the middle of the sky, how can I fix this?
It does not do the same with the day song from sunrise to the middle, the song just loops like normal.
(I'm also trying to expand the script so the music only play when you're inside a part, (a region part if I'd say) if it helps with slimming it down or avoiding some kind of confusion for when I get to that part.)
local DaySong = game.workspace.Music.Main
local NightSong = game.workspace.Music.News
if not game.workspace.Music.Main.IsPlaying then
game.workspace.Music.Main:Play()
end
while true do
wait(5)
if game.Lighting:GetMinutesAfterMidnight() > 6 * 60 then
if NightSong.IsPlaying and not DaySong.IsPlaying then
NightSong:stop()
wait(.5)
DaySong:play()
print("Working660")
end
end
if game.Lighting:GetMinutesAfterMidnight() > 16 * 60 then
if DaySong.IsPlaying and not NightSong.IsPlaying then
DaySong:stop()
wait(.5)
NightSong:play()
print("Working1660")
end
end
end
