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?
ID = '317251079' -- Music ID Looped = true -- False for Non-Looping Music Music=Instance.new("Sound" ,Workspace) Music.Name = "Music" if Looped == true then Music.Looped = true end Music.SoundId = "http://roblox.com/asset/?id=317251079" -- Music ID Music:Play()
local musicTracks = { "http://roblox.com/asset/?id=317251079", "add more" } music = musicTracks[math.random(1,#musicTracks)] music:Play()
local musicPlaylists = { "http://roblox.com/asset/?id=317251079", " add more" } Music.Ended:(connect(function() Music.SoundId = musicPlaylists[math.random(1,#musicPlaylists)] Music:Play() end)