So basically, I'm trying to get a script to play a song, when the game starts, then once that has finished, I want it to play a different song, picked randomly from a list. So how would I do that? I've gotten the basics of the loops, but only of one song. Can someone help please?
01 | ID = '317251079' -- Music ID |
02 | Looped = true -- False for Non-Looping Music |
03 |
04 | Music = Instance.new( "Sound" ,Workspace) |
05 | Music.Name = "Music" |
06 | if Looped = = true then |
07 | Music.Looped = true |
08 | end |
09 | Music.SoundId = "http://roblox.com/asset/?id=317251079" -- Music ID |
10 | Music:Play() |
1 | local musicTracks = { |
3 | "add more" |
4 | } |
5 |
6 | music = musicTracks [ math.random( 1 ,#musicTracks) ] |
7 | music:Play() |
1 | local musicPlaylists = { |
3 | " add more" |
4 | } |
5 | Music.Ended:(connect( function () |
6 |
7 | Music.SoundId = musicPlaylists [ math.random( 1 ,#musicPlaylists) ] |
8 | Music:Play() |
9 | end ) |