Okay, so I am trying to create a shuffled playlist using 9 different sound instances, and a single script. The objective is to play each songs once, until they are all played, and then start over.
Currently, the only time music is played is when the first song is supposed to start. The first song is only played about 25% of the time. I have checked everywhere I can think of for answers, and no dice. My code is:
-- made by oCrxptic
local length = 0
local songs = game.ReplicatedStorage.Songs:GetChildren()
while true do
wait(0.1)
if #songs >= 1 then -- Music available to be played
print("Playing")
local index = math.random(1,#songs)
songs[index]:Play()
print("Playing: "..songs[index].Name)
length = math.ceil(songs[index].TimeLength)
table.remove(songs,index)
wait(length)
elseif #songs <= 0 then
songs = game.ReplicatedStorage.Songs:GetChildren()
print("Resetting songs...")
else
warn("Something went wrong with music.")
end
end
Line 12 always prints a new song name when it is supposed to, which is weird to me, because then I would think that the song should also be playing.
Any help is appreciated!

2 comments
This works slightly. I am not looking for a new format for accomplishing the same thing, unless it is necessary.
Don't forget to accept my answer if it helps.