I’d like to achieve a GUI button that will change volume in settings when player clicks on GUI button.
My issue is that I don’t really know which functions do I have to use to get this volume function from settings. If you still doesn’t understand what I want to achieve is that I am trying to change this volume settings in script:
It gives me an error of course that I cannot set master sound volume when I click on button of course.
I am not sure if I am using correct thing to change this volume in settigns but still I have tried this.
I hope anyone could help me with this and I hope you are having an amazing day today
UserSettings():GetService(“UserGameSettings”) are read-only properties, you cant edit them to prevent abuse from developers, change the sounds volumes instead.
I know this but I have an problem and this that I have several sounds in game if I would have to change volume of every sound to 0 by one by one. Is there really no easier way to do this? I will make it like that if answer is no thought.
Unless you scattered the objects across the game without setting them in one single folder or something, then that should be better without looping through unnecessary objects.
Yes I mean guys sorry for that I totally forgot about :GetChildren(). I will add them in same folder and use this function and set them all to 0 volume, sounds logical to me if I am wrong please tell me.
If you’re looking to create a volume slider or overall volume modifier of sorts, I don’t ever recommend changing the Volume of the Sound instance itself. Individualised volume is pretty important over making all sounds a certain volume. Use SoundGroups, they give you way more control in just one object.
You can assign all your sounds to a SoundGroup and uniformly change their volume by a multiplication factor here, which is what the Volume slider in the Escape Menu essentially does. You can retain the volume of the original sounds while fine tuning the percentage you can hear it by.
One volume change, all sounds assigned to this SoundGroup change as well. In addition to this, you can make cool effects. For example, want a near-death effect where sounds get muffled the lower your health is? Just add an effect to the SoundGroup and all sounds will be affected.
I suggest assigning the SoundGroup of all objects you want to be affected by the volume changes to the SoundGroup controlling the volume. 100% of the volume would be SoundGroup.Volume set to 1. 0% would be 0. And then you obviously set up your UI to edit the volume of this SoundGroup.
while soundgroups can be useful, not everyone uses them or don’t even notice them. they can also use soundgroups for ex. radio music with an equalizer, making it impossible for multiple soundgroups to be used. if you can’t use soundgroups you’re just better off to use game/workspace:GetChildren or GetDescendants.