Mute Button GUI

Does anyone know how I can do this

local music = game.Workspace.GameSongs.Sound
local music2 = game.Workspace.GameSongs.Sound2

script.Parent.MouseButton1Click:Connect(function()

	if music.Volume == 0.5 then

		music.Volume = 0
		script.Parent.Parent.RoundMusic.BackgroundColor3 = Color3.new(0.666667, 0, 0)
	else

		music.Volume = 0.5
		script.Parent.Parent.RoundMusic.BackgroundColor3 = Color3.new(0, 1, 0)

	end
end) 

Im trying to make it so that the 1 Button Mutes both sounds depending on which one is being played does anyone know a solution to this

image

You can have a variable for which one is currently playing and use that to mute it instead.

is it not possible to do this if music or music2.Volume == 0.5 then or is that not possible

You would need to do if music.Volume == 0.5 or music2.Volume == 0.5. However, I would not recommend this as having a variable that is set to the current song playing will be more scalabe in the future for adding more songs. You don’t want a pasta of if statements. Good luck :slightly_smiling_face:

alright thanks ill try it out!!!