I’m attempting to create a playlist, in which picks a random song every time a song ends. Unfortunately, it only plays 1 song, and after is has ended, it doesn’t play another song. What’s the concurrent issue here? I’m proceeding to assume that I may have used an inaccurate function, which is repeat wait until
, but I’m not sure. Here’s the code:
local ids = {601790165, 1666515576, 2203122009, 3143083388, 1632522359, 587468803, 2683642139, 602136047, 2832773762, 1334793858, 706628304, 3035657191, 2890946507, 4755430395, 3743920540, 2992018267, 4595551862, 616542359, 4926033735, 2057045883, 4380429016, 3063659387, 372065073}
local function music()
local se = Instance.new("Sound")
se.Name = "BackgroundMusic"
se.Parent = game.Workspace
se.Volume = .9
repeat wait()
local chosenid = ids[math.random(1, #ids)]
se.SoundId = "rbxassetid://"..chosenid
se:Play()
until se.Ended:Wait()
end
music()