I know this script would have lots of mistakes and would be complicated; it would be really appreciated if you could help me make it less sophisticated too. :)
local sound = script.Parent songs = { id1 = 181927642; name1 = "Ariana Grande - Last Christmas"; id2 = 603146550; name2 = "Cartoon - On & On" } while next do local song = songs.id1 or songs.id2 if song == string.sub(1,4)=="name" then else sound.SoundId = "rbxassetid://"..math.abs(song) if song == songs.id1 then sound.Name = songs.name1 elseif song == songs.id2 then sound.Name = songs.name2 end sound:Play() if sound.IsPlaying == false then song = songs.id2 or songs.id1 end repeat wait(1) until sound.TimePosition == sound.TimeLength end end
Well you have a really complicated code. And it can all come out to something really easy....
local sound = script.Parent local songs = {"Song id's"} local song = 1 local title = -- Put here where you text frame is while true do wait(1) function setSong() local song = songs[Song] Song = Song + 1 sound.SoundId = "rbxassetid://"..song if Song == #songs + 1 then Song = 1 end end sound.SoundId = "Song Id here" then title.Text = --Name of song here inside these: " " end if not sound.IsPlaying then setSong() sound:Play() end end
Then all songs in the songs table, will play in that playlist. And the playlist will repeat, when it's done. Hope that helped you. - Toby
Actually (I'm only editing this script to help others) I found an easier and efficient way to create it:
local Sound = script.Parent-- Create a variable to get your sound songs = { 1367367158, 891225839, }-- IDs go in here. names = { "Kisma - Fingertips", "TheFatRat - Fly Away", }-- Names go in here. for i, v in ipairs(songs) do-- function Sound.SoundId = "rbxassetid://"..songs[i]-- Changes the song ID Sound.Name = names[i]-- Changes the song Name Sound:Play()-- Plays the music repeat wait(1) until Sound.IsPlaying == false-- Waits until this music is finished to play next music if i == ((2)) then -- Put in the amount of songs you have in the double brackets i = 1 end end
Hope it helps!