In-Game Music Issue

Currently trying to add in-game music to my showcase map using a working script I’ve used in another map of mine. When tested, however, Music2 initially plays alongside Music1. Testing out my other map, the script seems to work fine so I am unsure as to why both Music1 and 2 play at the same time when testing. Any clues? Script below.

local Music1 = game.SoundService.Music1
local Music2 = game.SoundService.Music2
local Music3 = game.SoundService.Music3
local Music4 = game.SoundService.Music4
local Music5 = game.SoundService.Music5
local Music6 = game.SoundService.Music6
local Music7 = game.SoundService.Music7
local ServerHasPlayers = false

game.Players.PlayerAdded:Connect(function()
	if ServerHasPlayers == false then
		ServerHasPlayers = true
		
		Music1:Play()
		
		Music1.Ended:Connect(function()
			Music2:Play()
		end)
		
		Music2.Ended:Connect(function()
			Music3:Play()
		end)
		
		Music3.Ended:Connect(function()
			Music4:Play()
		end)
		
		Music4.Ended:Connect(function()
			Music5:Play()
		end)
		
		Music5.Ended:Connect(function()
			Music6:Play()
		end)
		
		Music6.Ended:Connect(function()
			Music7:Play()
		end)
		
		Music7.Ended:Connect(function()
			Music1:Play()
			print("Restarting Music")
		end)
	end
end)
1 Like

At this point why not just use

while true do wait()
for i= 1,7 do
local currentsong = game.SoundService["Music"..i]:Play()
currentsong.Ended:Wait()
end
end
2 Likes

Are you saying to replace a certain part of the script with this or replace the entire script? I apologize since I stink at scripting so I have trouble understanding

I would just use the script I sent.

Doing so seemed to only play the first song, might be an issue on my end but not sure.

Do you have the Playing property checked true in Music2 in this map? This would cause it to play automatically when the game loads in.

Nah I don’t, all of the properties are the same across each song

the only issue would be what scottify said. other than that theres no issue