Hey, first post here.
I am trying to recreate the default Roblox Voice Chat system.
As a proof of concept, I have tried to create a simple Voice Chat Script, but when I got to test it, other players cannot hear the AudioEmitter that’s wired from AudioDeviceInput. I can wire it so that the player can hear themselves, but other people cannot hear other players.
I’ve tried things like setting game.SoundService.RespectFilteringEnabled
to Disabled
, still no help. I have tested this on a live game, so not a Studio Issue. I have included AudioDeviceOutputs and AudioListeners in a LocalScript, so that’s not the issue.
This is the Serverside code that creates the Audio instances, borrowed from this post for proof of concept.
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
-- Connect the devices together
connectDevices(micIn, emitter)
end)
end)
And here is the client sided code, again, borrowed from this post.
local camera = workspace.CurrentCamera
local listener = Instance.new("AudioListener")
listener.Parent = camera
local audioOut = Instance.new("AudioDeviceOutput")
audioOut.Parent = listener
local wire = Instance.new("Wire")
wire.Parent = listener
wire.SourceInstance = listener
wire.TargetInstance = audioOut
Help very much appreciated!