Mute music doesn't work

I’ve added a mute music in game, now I’ve worked on so many mute music systems before but some reason it doesn’t want to work.

local ss = game:GetService("SoundService")
local sounds = ss:WaitForChild("MusicGroup"):GetChildren()

local Configuration = script:WaitForChild("SoundConfig")
local Volume = Configuration.Sound -- Value is a NumberVal and uses a decimal


local button = script.Parent

button.MouseButton1Down:Connect(function()
	for i, v in pairs(sounds) do
		if v:IsA("Sound") then
			
			if v.Volume == Volume then
				button.Text = "Music: Off"
				v.Volume = 0 -- It makes the volume zero
		
			else
				button.Text = "Music: On"
				v.Volume = Volume -- But it doesn't make it unmuted nor does the text change
			end
		end
		
		
		
	end
	
	
	
end)
1 Like

This should be it.

local Volume = Configuration.Sound.Value
2 Likes

Omg, no wonder it didn’t work! Such a stupid mistake that I did in my part. Thanks for pointing it out!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.