When game runs sound plays normally, but when you click button it doesn't stop
game.Players.PlayerAdded:connect(function(plr) local startsound = plr.PlayerGui:FindFirstChild('Sound') if startsound then if startsound.Name == "BackgroundMusic" then startsound:Play() end end game.StarterGui.ScreenGui.StartFrame.PlayButton.MouseButton1Click:connect(function() local stopsound = plr.PlayerGui:FindFirstChild('Sound') if stopsound then if stopsound.Name == "BackgroundMusic" then stopsound:Stop() end end end) end)
You bind the click function to the StarterGui*. You should use the plr.PlayerGui
instead.
*StarterGui is the service that clones all instance inside of it, to the players PlayerGui
when their character gets added. (On entering the game, or respawning)