Music Player only plays once

Hello there,
I recently made a music player from my simulator.
I’m currently having some issues with it. After the song finishes, a new song is NOT chosen (it does not play at all!)

Here is my script:

local ContentProvider = game:GetService('ContentProvider')
local MusicIDs = {1843382633,1838058421,1842967125,1837871067,1842104602,1843384340,1847606521}
local PreviousSong

--ContentProvider:PreloadAsync({MusicIDs})


while true do
	local ChosenSong
	
	if #MusicIDs == 0 then
		continue
	end
	
	if PreviousSong ~= nil then
		while ChosenSong == PreviousSong do
			print('looping')
			wait(.5)
			math.randomseed(tick() ^ 3 * (3/math.tan(math.random(3,100)) * math.abs(math.random(1,9))))
			ChosenSong = MusicIDs[math.random(1,#MusicIDs)]
		end
	else
		math.randomseed(tick() ^ 3 * (3/math.tan(math.random(3,100)) * math.abs(math.random(1,9))))
		ChosenSong = MusicIDs[math.random(1,#MusicIDs)]
	end
	
	local Song = Instance.new('Sound')
	Song.Name = 'CurrentSong'
	Song.Parent = workspace
	Song.SoundId = "rbxassetid://"..ChosenSong
	
	Song:Play()
	
	Song.Stopped:Wait()
	
	PreviousSong = ChosenSong
	
	wait(1)
	
	Song:Destroy()
	
end

Does anybody know why this happens?

Can you check the output for errors and post them here. Also try adding print statements.

If there were errors I would have posted them.
I added prints, underneath where I do: Song.Stopped:Wait(), that never prints.

(So Song.Stopped:Wait() doesn’t stop yielding the script.)

Do you know why this is happening?

I still have this issue! Help is appreciated!

you should make chosensong a variable outside of the loop lol

they’re both equal to nil so they’re going to be equal in the while chosen == previous statement. The rest looks good though.

You should do Song.Ended instead because Song.Stopped fires when the song is stopped the using Song:Stop() function but Song.Ended fires when the song ended.