Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I'm not sure why my music script isn't carrying on to the next song? [ANSWERED; FREE SCRIPT BELOW]

Asked by 5 years ago
Edited 5 years ago

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. :)

01local sound = script.Parent
02songs = {
03    id1 = 181927642;
04    name1 = "Ariana Grande - Last Christmas";  
05    id2 = 603146550;
06    name2 = "Cartoon - On & On"
07}
08while next do
09    local song = songs.id1 or songs.id2
10    if song == string.sub(1,4)=="name" then
11 
12    else
13        sound.SoundId = "rbxassetid://"..math.abs(song)
14        if song == songs.id1 then
15            sound.Name = songs.name1
View all 25 lines...

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Well you have a really complicated code. And it can all come out to something really easy....

01local sound = script.Parent
02local songs = {"Song id's"}
03local song = 1
04local title = -- Put here where you text frame is
05 
06while 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
View all 31 lines...

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

0
Oh, I'm really grateful for you giving a script or me, but I was looking for a person who could fix my script. Thank you so much though! :D ISkyLordDoge 37 — 5y
0
I made a small change. There was a variable missing... tobiO0310 58 — 5y
0
Also accept this, if you don't need any help more. ;) tobiO0310 58 — 5y
0
I just remembered something! I was going to have a string saying the name on it... though, I'm sorry if this is drowning your time. ISkyLordDoge 37 — 5y
View all comments (2 more)
0
Try and look at the code now, I made it so that you can have a text frame for the title. tobiO0310 58 — 5y
0
Thanks! ISkyLordDoge 37 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Actually (I'm only editing this script to help others) I found an easier and efficient way to create it:

01local Sound = script.Parent-- Create a variable to get your sound
02 
03songs = {
04    1367367158,
05    891225839,
06}-- IDs go in here.
07names = {
08    "Kisma - Fingertips",
09    "TheFatRat - Fly Away",
10}-- Names go in here.
11 
12for 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
16repeat 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
20end

Hope it helps!

Answer this question