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. :)
01 | local sound = script.Parent |
02 | songs = { |
03 | id 1 = 181927642 ; |
04 | name 1 = "Ariana Grande - Last Christmas" ; |
05 | id 2 = 603146550 ; |
06 | name 2 = "Cartoon - On & On" |
07 | } |
08 | while next do |
09 | local song = songs.id 1 or songs.id 2 |
10 | if song = = string.sub( 1 , 4 ) = = "name" then |
11 |
12 | else |
13 | sound.SoundId = "rbxassetid://" ..math.abs(song) |
14 | if song = = songs.id 1 then |
15 | sound.Name = songs.name 1 |
Well you have a really complicated code. And it can all come out to something really easy....
01 | local sound = script.Parent |
02 | local songs = { "Song id's" } |
03 | local song = 1 |
04 | local title = -- Put here where you text frame is |
05 |
06 | while true do |
07 | wait( 1 ) |
08 |
09 | function setSong() |
10 |
11 | local song = songs [ Song ] |
12 |
13 | Song = Song + 1 |
14 |
15 | sound.SoundId = "rbxassetid://" ..song |
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:
01 | local Sound = script.Parent -- Create a variable to get your sound |
02 |
03 | songs = { |
04 | 1367367158 , |
05 | 891225839 , |
06 | } -- IDs go in here. |
07 | names = { |
08 | "Kisma - Fingertips" , |
09 | "TheFatRat - Fly Away" , |
10 | } -- Names go in here. |
11 |
12 | for i, v in ipairs (songs) do -- function |
13 | Sound.SoundId = "rbxassetid://" ..songs [ i ] -- Changes the song ID |
14 | Sound.Name = names [ i ] -- Changes the song Name |
15 | Sound:Play() -- Plays the music |
16 | repeat wait( 1 ) until Sound.IsPlaying = = false -- Waits until this music is finished to play next music |
17 | if i = = (( 2 )) then -- Put in the amount of songs you have in the double brackets |
18 | i = 1 |
19 | end |
20 | end |
Hope it helps!