this is been driving me crazy, and i have a script that plays music in the background. The annoying part is it restarts whenever they player dies. Is there a fix for this?

script.Parent:WaitForChild("Sound5"):Play()

script.Parent.Sound1.Ended:Connect(function()
	script.Parent.Sound1:Stop()
	script.Parent.Sound2:Play()
end)
script.Parent.Sound2.Ended:Connect(function()
	script.Parent.Sound2:Stop()
	script.Parent.Sound3:Play()
end)
script.Parent.Sound3.Ended:Connect(function()
	script.Parent.Sound3:Stop()
	script.Parent.Sound4:Play()
end)
script.Parent.Sound4.Ended:Connect(function()
	script.Parent.Sound4:Stop()
	script.Parent.Sound5:Play()
end)
script.Parent.Sound5.Ended:Connect(function()
	script.Parent.Sound5:Stop()
	script.Parent.Sound1:Play()
end)

5 comments

0

They can't just reset when they die, they are most likely placed in the Backpack, PlayerGui, or Character.

0

assuming you want the music to be for that client only, you could put them in a gui and then set ResetOnSpawn to false

0

I'm assuming this script is in a local-script. You could always try puttting it in a server script so it doesn't stop and it plays at the same time for all players I think.

0

Workspace / SoundService should work fine.

0

oh yeah putting it inside a gui worked thanks i feel kinda stupid now