I saw the new audio API, and saw others making a voice chat radio with it? The new API is kinda difficult to understand and I need help adding voice chat to my radio. Please help!
This is my current system:
it has a chat system with a mute button (activation) video
Please help again. I need someone to guide me through the voice api and the voice chat stuff. I just need the voice chat to not only talk from the character, but with the player as well!
From looking at the roblox api reference for a little bit, it looks like you should only need an AudioDeviceInput, and an AudioEmitter. Connect them together with a Wire.
I’ve already tried this before, and looked at many tutorials! I’m not sure as to why it doesn’t work, though I’ve looked at example places and such and tried the most simplest thing: An AudioDeviceInput connected to an AudioEmitter with a Wire. I made a testing place for this and this is the script:
function connectDevices(src, target)
local wire = Instance.new("Wire")
wire.Parent = target
wire.SourceInstance = src
wire.TargetInstance = target
end
game.Players.PlayerAdded:Connect(function(player)
-- Create a new AudioDeviceInput
local micIn = Instance.new("AudioDeviceInput")
micIn.Parent = player
micIn.Player = player
micIn.Muted = false
-- Assign a CharacterAdded event incase the player dies and respawns
player.CharacterAdded:Connect(function(character)
-- Make a new AudioEmitter with its Parent being the Character
local emitter = Instance.new("AudioEmitter")
emitter.Parent = character:WaitForChild("Head")
-- Connect the devices together
connectDevices(micIn, emitter)
connectDevices(micIn, workspace.Part.AudioEmitter) -- I added this for testing; I made a part in workspace and added an AudioEmitter
end)
end)
If I’m not mistaken, this should work in theory. Although I tested this in a live Roblox server and I don’t hear my voice coming out of that part.
This might be because of the newly added DistanceAttenuation property but i setted it to something like
this much and it still doesnt work. and I even made matching groups. I do not know what is going on and this is so confusing!
This script is a bit of a mess, but can you run this and see if it works? It works for me, and depending on if it works for you too, we’re close to pinpointing the issue for you (whether it’s in the script or an out the script configuration)
i recently got myself a system that can replay my voice and recreates the voice chat system. ill look into adding that script in a bit before i try something my own because im finally getting somewhere with this.