math.randomseed( os.time() ) -- Seed random number generator local musicReference = math.random( 1,7 ) if ( musicReference == 1 ) then bgmusic = audio.loadStream( "sound1.mp3" ) elseif ( musicReference == 2 ) then bgmusic = audio.loadStream( "sound2.mp3" ) elseif ( musicReference == 3 ) then bgmusic = audio.loadStream( "sound3.mp3" ) elseif ( musicReference == 4 ) then bgmusic = audio.loadStream( "sound5.mp3" ) elseif ( musicReference == 5 ) then bgmusic = audio.loadStream( "sound6.mp3" ) elseif ( musicReference == 6 ) then bgmusic = audio.loadStream( "sound7.mp3" ) elseif ( musicReference == 7 ) then bgmusic = audio.loadStream( "sound8.mp3" ) end function playbtn:tap( event ) local bgmusicChannel = audio.play( bgmusic, { loops = -1 } ) end playbtn:addEventListener( "tap", playbtn ) function stopbtn:tap( event ) audio.stop( 1 ) end stopbtn:addEventListener( "tap", stopbtn )
Right now I currently have this and once you open up the app it will change a song but as long as I keep the app open it will repeat that same song. How do I make it so it will shuffle and play different songs after every song and is there a way to make a skip button to go to the next song? Thank you for all the help!