I have script for a 60 minute day cycle, which means its day for 30 minutes and night for 30 minutes. I am new to scripting and I attempted to create a script that will loop music during the day, and a different music at night.
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function()
repeat wait() until player.Character
if game.Lighting.ClockTime > 5 and game.Lighting.ClockTime < 17 then
script.Day:Play()
script.Night:Stop()
if game.Lighting.ClockTime > 17 and game.Lighting.ClockTime < 5 then
script.Night:Play()
script.Day:Stop()
end
end
end)
end)
The layout is as follows:
LocalScript Day Sound Night Sound
This script isn't working and plays nothing at all. Advice? Please be descriptive!

4 comments
Thanks, this helped a lot! But when I tried this script, the audio was continuously Playing over and over, so I changed Play() to Resume(), and that fixed that problem, but now the Day only plays and Night never plays, and Day never stops. Why?
use the changed event. game.Lighting.Changed:connect(function()
(REST OF SCRIPT)
end)