Audio API Problem

So I was just working with ROBLOX’s new Audio API that’s been released. I saw in Roblox documents, they had created a push-to-talk script, just what I needed.

I’ve also created an AudioDeviceInput and put it in the VoiceChatService along with my local script.
image

For some reason, this doesn’t work at all. I’m not getting any error or warning, nor is this working in game. I have enabled microphone to talk in game settings, but I’m unable to get this to work. Please help!

local players = game:GetService("Players")
local userInput = game:GetService("UserInputService")
local audioIn : AudioDeviceInput = players.LocalPlayer:WaitForChild("AudioDeviceInput")
audioIn.Muted = true

local pushToTalkKey = Enum.KeyCode.V

userInput.InputBegan:Connect(function(input: InputObject)
    if input.KeyCode == pushToTalkKey then
        audioIn.Muted = false
    end
end)

userInput.InputEnded:Connect(function(input: InputObject)
    if input.KeyCode == pushToTalkKey then
        audioIn.Muted = true
    end
end)
2 Likes

Sorry to bump the post, but I’m having the exact same issue with that script. It just doesn’t work at all. Did you ever find a fix?


If you never found a solution, I discovered how the muted thing actually works.

You still have to manually activate / deactivate your VC with the button in the top left. That button doesn’t actually mute/unmute your mic. It toggles your VC either active or inactive.

This script will mute/unmute your VC. Assuming you have toggled your VC to be active in the top left, you’ll notice that it only records audio when holding down the V key.


TLDR: You have to manually click the VC button, then use push to talk.

2 Likes

Ohhhhhh BRUH I need to find a better fix.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.