I am making this game where there is a fixed camera angle and players stand behind it so they are not in frame. Now i want to make a ui for when players press it they can mute/ unmute their mic because right now they have the press esc and then mute or unmute it.
I’ve tried to searching about this topic but did not find much information about it.
It’s kind of possible to achieve that, but there’s a caveat.
For reference, when players mute or unmute their microphone through the CoreGUI / Roblox Settings Menu, that changes what the AudioDeviceInput.Active property is set to.
When it’s on, audio is being recorded from their input device
When it’s off, audio is not being recorded at all
Importantly, the Active property cannot be changed via a script.
However, if you relied on players to keep their microphone turned on via the Roblox Settings Menu, you could then allow players to use UI to toggle the scriptable AudioDeviceInput.Muted property.
When AudioDeviceInput.Muted is enabled / set to true, recorded audio will not be transmitted through AudioEmitters / to AudioDeviceOutputs.
Note: If the property is turned on via server-sided code, then only the server has the authority to turn it back off. This could be compared to the “Server Mute” feature on platforms like Discord.
However, if the property is turned on via the client / through a LocalScript, the client can decide at any time when to turn it back off.
When it’s turned off / set to false, recorded audio can be transmitted, so long as the player has their microphone enabled via the CoreGUI / Roblox Settings.
In this scenario, the Roblox client will continue recording audio unless the player decides to use the microphone toggle in the CoreGUI / Roblox Settings Menu. When audio recording is turned off through the CoreGUI / Roblox Settings Menu, it doesn’t matter what the AudioDeviceInput.Muted property is set to because the AudioDeviceInput.Active property takes priority / it is what determines if the Roblox client is actively recording incoming audio via their microphone or not.
TL;DR
It’s not possible to turn on the player’s microphone for them, but if they already have it enabled via the CoreGUI / Roblox Settings Menu, you can update the AudioDeviceInput.Muted property to true or false through code in order to allow them to more conveniently mute / unmute their microphone.