I have the below code, and the sound plays, but only for about 3-10 seconds then stops. Any input as to why this is happening? EG. If I save the file ( so it auto-reloads) the sound starts playing, when I alt tab to the game it stops. If I just save the file then dont’ touch anything, it seems to play fine?
function GAME.PlayBackgroundMusic( path ) local sound = CreateSound( game.GetWorld(), path ) sound:SetSoundLevel(0) sound:Play() end GAME.PlayBackgroundMusic( "music/background.mp3" )
Ideally I just want to achieve repeating background music - what’s the best way to do this / make sure when the music ends it starts playing again.