Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there any script that mutes all sound in the game?

I want to have button which mutes all sound in the game.

2 comments

0

In Workspace? Or the entire game

0

Entire Game

1 answer

✓ Accepted answer

You should design a game using SoundGroups as it will allow you to mute the groups you want ie music, sfx and other channels.

It is best to handle the sound correctly when it is added into your game by setting a sound group for it.

You can do this with a script but you would not know the original volume of the sound as you cannot simply stop all music due to a lot of scripts needing to play sound is the character died.

A basic approach would be to get a list of all sound instances and set the volutme to 0 then connect an event to set all new sound instances volume to 0 as well

for _, itm in pairs(game:GetDescendants()) -- i am unsure the locations of where sound can be played so I will simple mute all sounds. 
-- you can do your own testing to find where sounds play
	
	if itm:IsA('Sound') then
		itm.Volume = 0
	end	
end

-- mute all other sound added to the game
game.DescendantAdded:Connect(function(ins)
	if ins:IsA('Sound') then
		ins.Volume  = 0
	end
end)

I hope this helps. You will need to look at which method is best for you.

This discussion is preserved as it was. New answers, comments, and votes are closed.