I have been stumped on this for a while and cannot figure this out. I have followed other dev forum tutorials and for some reason mine does not add up correctly. I am unable to test the queue as it keeps skipping through to the last song. Any suggestions as to how to fix this? I’m trying to get it to play one at a time.
while wait() do
if Music.IsPlaying == false then
local SelectedSong
Music.TimePosition = 0
if not Queue[1] then
for Order = 1, #Songs do
SelectedSong = "rbxassetid://"..Songs[Order]
local Success, SongInfo = pcall(function()
return MarketPlaceService:GetProductInfo(string.sub(SelectedSong, 14), Enum.InfoType.Asset)
end)
SongName.Value = SongInfo.Name
RequestedBy.Value = "Server"
Music.SoundId = SelectedSong
end
elseif Queue[1] then
SelectedSong = "rbxassetid://"..Queue[1].SongID
local Success, SongInfo = pcall(function()
return MarketPlaceService:GetProductInfo(string.sub(SelectedSong, 14), Enum.InfoType.Asset)
end)
SongName.Value = SongInfo.Name
RequestedBy.Value = Queue[1].PlayerName
table.remove(Queue, 1)
end
Music:Play()
wait(Music.TimeLength)
end
end