I want to make a music gui that changes the mute bg music/unmute bg music button. For some reason, it changes from ("Mute") to ("Unmute") but not back to ("Mute") and this is my script.
Top Half
-- variables --
local sound = game.SoundService.CustomSound
local frame = script.Parent.Settings
local ID = script.Parent.Settings.MusicID
-- open button --
script.Parent.Open.Activated:Connect(function()
frame.Visible = true
end)
-- open button --
script.Parent.Settings.Close.Activated:Connect(function()
frame.Visible = false
end)
-- music ID --
sound.SoundID.Value = ID.Text
sound.SoundId = sound.SoundID.Value
Important Part
-- mute music --
script.Parent.Settings.Mute.Activated:Connect(function()
game.SoundService.PlayingSounds.Volume = 0
script.Parent.Settings.Mute.Text = ("Unmute")
end)
-- unmute music --
script.Parent.Settings.Mute.Activated:Connect(function()
if script.Parent.Settings.Mute.Text ~= ("Mute") then
script.Parent.Settings.Mute.Text = ("Mute")
game.SoundService.PlayingSounds.Volume = 0.5
end
end)
