I want to detect when a player is using voice chat and preferably at what volume. Is there any way to detect when a player is talking and their volume?
Don’t think theres much customizability yet but you can check if a player has voice chat enabled
That would be cool if there was a thing where you could detect activity coming from a players microphone or it could be connected with voice chat so roblox wouldn’t have to give developers full access to players microphones and prevent hackers listening to people and stuff like that.
With that feature horror games could have there entities react to voice activity.
voice activity for different functions in games
You can detect if a player has Voice enabled by using the following code in a LocalScript:
local Players = game:GetService("Players")
local VoiceChatService = game:GetService("VoiceChatService")
local localPlayer = Players.LocalPlayer
local success, enabled = pcall(VoiceChatService.IsVoiceEnabledForUserIdAsync, VoiceChatService, localPlayer.UserId)
if not success or success == false and not enabled then
print(localPlayer.Name, "does not have Voice or does not have Voice enabled!")
end
if success and enabled then
print(localPlayer.Name, "has Voice enabled!")
end
At the moment you cannot check the volume of the microphone or if the player is talking. However, there is a service called VoiceChatInternal and it is still used by Roblox even though it’s marked as deprecated. How do we know that? Not only is it shown in Roblox’s logs and files, By enabling the “Show Deprecated” bar, you’ll see all the settings and functions used to detect device input, muting and muting states, Voice Chat states, and more!
You can also use IsVoiceEnabledForUserIdAsync
in the VoiceChatInternal
service as well!
Hope this helps!