Simple music playlist script stops playing

I wrote a simple music playlist script for my game, yet when the third song is supposed to play, it doesn’t work. This happens with every song that I try, and there are no errors in the output. I’m quite new to scripting so apologies if I’ve just made a rookie mistake.

music1 = "http://www.roblox.com/asset/?id=615592989"
music2 = "http://www.roblox.com/asset/?id=2023642240"
music3 = "http://www.roblox.com/asset/?id=2687873691"

local music = Instance.new("Sound")
music.Archivable = true


music.Parent = game.SoundService 
music.Volume = 0.25
music.Looped = false
music.Name = "Music"


while true do
	music.SoundId = music1 
	music:play()
	wait(57) 
	
	music.SoundId = music2
	music:play() 
	wait(235)
	
	music.SoundId = music3
	music:play() 
	wait(180)
end

The first two work perfectly

Just a side note, but you can do music.Ended:Wait() for a more better approach

Make sure that music3 is a valid SoundID and not deleted of any sort, also do add print() statements if you can

The third song played always stops no matter what audio I use, so it’s not the audio. Also thanks for the tip

Is there any error on console?

1 Like

Is it a Server or Local Script? I believe you can put the music’s Parent inside the workspace instead and change it to a server if so

There are zero errors, and the first two songs work perfectly

It’s a server script in ServerScriptService

Try changing the Music’s Parent to workspace, I believe SoundService only works client-sided

Try to do this, can give wayy lower work for you
create a folder inside the SoundService
put all your sounds inside folder and create a script with this inside :

local music1 = game.SoundService(show the path for your folder)
local music2 = game.SoundService(show the path for your folder)
local music3 = game.SoundService(show the path for your folder)
while true do
music1:play()
music1.Ended:Wait()
music2:play()
music2.Ended:Wait()
music3:Play()
music3.Ended:wait()
end

put the script on workspace as a Script if you want play the same sound for all server (players join and the sound can be on the middle)
or localscript if you want play the sound for each player. (going to start for every player when player joins)
Good luck! =D

1 Like

It works! Thank so much, I’ve been stuck on this for 2 days

1 Like

Np! If need any more help call me!
Also, can you give “Solution” to my reply?
Thank you! have a good day.