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

Music Player with different musics playing after one another?

Asked by 7 years ago
Edited 7 years ago

Basically, I want my music player to play songs in order with a shortened amount of lines, but I don't know how to do it. I need some help, this is the code for my music player. It's working but not as I want it to be (I obviously know that there is nothing that attempts to do what I want it to do, but I find no solution in attempting to do it).

How do I do it?

local ContentProvider=Game:GetService('ContentProvider');
local ServerStorage=Game:GetService('ServerStorage');
local Song=ServerStorage:WaitForChild('Song');
local Playing=false;

local Songs={
438917260; --// 1
143959455; --// 2
243372213; --// 3
142295308; --// 4
401120618; --// 5
130844430; --// 6
130797915; --// 7
142435409; --// 8
143204341; --// 9
131111368; --// 10
572476178; --// 11
221681020; --// 12
606541503; --// 13
577407393; --// 14
131154740; --// 15
};

local Track=1;

function PreLoadAssets(Assets)
for _, ID in pairs(Assets) do
ContentProvider:Preload('rbxassetid://' .. ID)
end;
end;

PreLoadAssets(Songs);

function StartSong()
Spawn(function()
repeat Wait(0);
for _, V in pairs(Songs) do
if not Playing then
Playing=true;
Song.SoundId = 'rbxassetid://' .. V
Track=V;
print(_, V, 'eyyoo');
Song:Play()
break;
end;
end;
until Song.IsPlaying==false;
Playing=false;
print('Done');
Track=Track+1;
print(Track);
StartSong();
end);
end;

StartSong();
0
oml... TheeDeathCaster 2368 — 7y
0
What do you mean by "playing after one another?" How is it not working as you intended to? Your question is vague; could you please expand & be more specific on what you're asking/ talking about? TheeDeathCaster 2368 — 7y
0
i didn't realize i didn't say anything about it rofl, changing Naxxanar 77 — 7y
0
You can loop through the list and connect the Ended event to a function that starts playing the next song. GoldenPhysics 474 — 7y

Answer this question