local music = game.Workspace.BGM
script.Parent.TextButton.MouseButton1Click:Connect(function()
if music.Volume == 0 then
music.Volume = 2.5
else
music.Volume = 0
end
end)
This script above is a LocalScript inside a ScreenGui.
local sound = game.Workspace.BGM
local muted = false
script.Parent.MouseButton1Click:Connect(function()
if muted then
sound:Resume()
muted= false
script.Parent.Text = "Mute Music"
else
sound:Pause()
muted = true
script.Parent.Text = "Unmute Music"
end
end)
This script is a LocalScript inside a TextButton inside the same ScreenGui with the first script, that makes the sound stop when pressed upon.

1 comment
cool