Not sure why my music system isn't working?

Hello! I’m trying to make a music system, but its not working. I’ve tried lots of things but I ended up with this script:

local Music = game.Workspace.Music.Music
local Music2 = game.Workspace.Music.Music2
Music2.Ended:Connect(function()
Music2:Stop()
Music:Play()
wait(120)
	Music:Stop()
	Music2:Play()
end)

Please help!

Note: Music2 is a short song that gets repeated a certain amount of times, that’s why I use a wait instead

Are you setting the music to play beforehand? It looks like it only runs your function once the music stops playing. Try something like this:

local Music = game.Workspace.Music.Music
local Music2 = game.Workspace.Music.Music2
Music2:Play()
Music2.Ended:Connect(function()
	Music2:Stop()
	Music:Play()
	wait(120)
	Music:Stop()
	Music2:Play()
end)

Music needs to start before it can end.

2 Likes

I think I know what the problem is :Play is not working.
When I turned off Playing on the music2 and then added Music2:Play() to my script. It wasn’t playing at all.

What does your new script look like?

local Music = game.Workspace.Music.Music
local Music2 = game.Workspace.Music.Music2
Music2:Play()
Music2.Ended:Connect(function()
	Music2:Stop()
	Music:Play()
	wait(120)
	Music:Stop()
	Music2:Play()
end)

I figured it out. Its because I made it a local script not a server script.

2 Likes