How to mute all audios in SoundService

I’m making a UI with a mute all sound button but I don’t know how I can get all the audios in the SoundService and mute them all at once.

Right now I got

local audioHolder = game:GetService("SoundService") -- place audios in SoundService
local audio = audioHolder:GetDescendants()

local SoundOn = script.Parent.volume_on
local SoundOff = script.Parent.volume_off

local Sound = true

if Sound == true and SoundOn.Activated then
	Sound = false
	audio.Playing = false
	
end

perhaps a for loop would help, along with if v:IsA("Sound") then

So like this?

local audioHolder = game:GetService("SoundService") -- place audios in SoundService
local audio = audioHolder:GetDescendants()

local SoundOn = script.Parent.volume_on
local SoundOff = script.Parent.volume_off

local Sound = true

if Sound == true and SoundOn.Activated then
    if v:IsA("Sound") then
      v.Playing = false
    end
end

You didn’t specify what v is. You need to do something like this:

local audioHolder = game:GetService("SoundService") -- place audios in SoundService
local audio = audioHolder:GetDescendants()

local SoundOn = script.Parent.volume_on
local SoundOff = script.Parent.volume_off

local Sound = true

while wait() do
for i, v in pairs(audioHolder:GetChildren()) do
if Sound == true and SoundOn.Activated then
    if v:IsA("Sound") then
      v.Playing = false
    end
end
end
end

You might have to modify some stuff like the order and probably add/remove an end.

Ohhhh that makes more sense thank you

1 Like