Mute Sound In Workspace

I make script that it mute all music or all children once i click the button

script :

local Songs = game.Workspace.Songs:GetChildren()
local Mute = script.Parent:WaitForChild("Mute")

Mute.MouseButton1Click:Connect(function()
	if Songs.Volume == 0.4 then
		Songs.Volume = 0
	else
		Songs.Volume = 0.4
	end
end)

Untitled

The volume of all sounds is 0.4

You’re trying to get use .Volume on a table, you could just have a variable that detects if something is muted or not and loop through the sounds folder and mute or unmute depending on the value in the variable, somethign like this

local Songs = game.Workspace.Songs:GetChildren()
local Mute = script.Parent:WaitForChild("Mute")

local muted = false

Mute.MouseButton1Click:Connect(function()
	for _,song in pairs(Songs) do
		song.Volume = muted and 0.4 or 0
	end
	muted = not muted
end)

or a more practical solution would be to understand what SoundGroups are, which would make it simpler to mute and unmute multiple songs, but I haven’t really touched them yet so you’ll have to do your own research and understanding on what it is

1 Like

Ok thanks solution award!! thanks again

1 Like

Anytime! If you have anymore issues don’t be afraid to make another post!