Sound not playing audio but playing boolean is true?

I am attempting to make a simple song request system. the system I have now simply plays default music until somebody suggests something different. The default sounds plays correctly the first time but when it comes around to play it again the audio doesnt play at all. The playing boolean value is true however and even the UI changes accordingly with my remote event but the audio is not making any noise. I put print statements inside the function itself and it even prints it accordingly.


local function playMusic(song)
	game.ReplicatedStorage.Sounds.Music.SoundId = "rbxassetid://"..song.SongId
	if game.ReplicatedStorage.Sounds.Music.IsLoaded == false then
		game.ReplicatedStorage.Sounds.Music.Loaded:Wait()
	end
	game.ReplicatedStorage.Sounds.Music:Play()
	RemoteEvents.NowPlaying:FireAllClients(song.SongName)
	wait(game.ReplicatedStorage.Sounds.Music.TimeLength)
end
	while true do
		for _,song in ipairs(defaultPlaylist) do
			if #queuedSongs <= 0 then
				playMusic(song)
			else
				print("playing queued")
				playMusic(queuedSongs[1])
				table.remove(queuedSongs, 1)
			end
		end
		game:GetService("RunService").Heartbeat:Wait()
	end
end)()

Could you try doing

game.ReplicatedStorage.Sounds.Music.Ended:Wait()

Instead of

	wait(game.ReplicatedStorage.Sounds.Music.TimeLength)

?

yup, they both did the same thing.

Maybe try encasing the Sound change in a pcall?

local function playMusic(song)
	game.ReplicatedStorage.Sounds.Music.SoundId = "rbxassetid://"..song.SongId
	if game.ReplicatedStorage.Sounds.Music.IsLoaded == false then
		game.ReplicatedStorage.Sounds.Music.Loaded:Wait()
	end
    
    local Yes, No = pcall(function()
	    game.ReplicatedStorage.Sounds.Music.IsPlaying = true
    end)

    if Yes then
        print("The sound should be playing fine?")
    else
        warn(No)
    end

	RemoteEvents.NowPlaying:FireAllClients(song.SongName)
	wait(game.ReplicatedStorage.Sounds.Music.TimeLength)
end

that makes 0 sense? There are no errors. Why would pcall it? Please do not say random answers unless you have an idea of what it will fix.

Well idk what else could be the potential issue for this then

The only other thing is that I do recall some certain Sounds not being able to be played again when upon selected, but it seems to be a rare occurrence from the posts made by the Forum

This is probably the most relevant thing I could find, other than that I have nothing else to say

An alternate could be to use SoundService’s PlayLocalSound on the client instead of playing it on the server perhaps?