I’m currently working on a new game and a for a settings menu and am looking for a way to disable all sounds in the game, except one. (The background music)
Alot of the sounds are in parts in ServerStorage to later be cloned and placed in the workspace. When a part is placed it plays a sound. How would I turn off the sound?
Things I’ve tried:
I have tried looping through a folder in the workspace with a local script and setting the volume to 0 to all sounds it finds.
This was unsuccessful.
I suppose all the sounds that are playing are in workspace? Try hearing for
:DescendantAdded() and mute the sounds.
local function mute(sound)
if not sound:IsA("Sound") then return; end
sound.Volume = 0;
for _,s in ipairs(workspace:GetDescendants()) do
This works great. Once again, it’s my own stupidity.
I did the same thing only with ChildAdded()
Thanks for the help.
I would link them all to SoundGroups (especially since SoundGroup layers are available now)
Then, once you want to mute it, set the soundgroup “SFX” volume to 0.
This is WAY more efficient than looping through sounds (or the entire workspace) since you’re only changing one property. If you have a big game, eventually looping through the workspace could cause noticable stuttering.
Thanks I will try that. Right now it’s only a folder or two that I need to watch for decedentAdded. I will probably do your idea in the future, but to link all those sounds will take a while.