Hi! I am trying to make global voice chat work on my game, which means instead of spatial voice chat, everyone can just hear everybody else without needing to be near them.
I used this script from a devforum post a couple months ago, but the “Invalid Wire Connection: No Matching Target Name” keeps showing up.
local players = game:GetService("Players")
-- Create a global listener for all audio
local globalListener = Instance.new("AudioListener", game.Workspace)
globalListener.Name = "GlobalAudioListener"
local function connect(src: Instance, dst: Instance)
local wire = Instance.new("Wire", dst)
wire.SourceInstance = src
wire.TargetInstance = dst
end
local function onPlayerAdded(player: Player)
local input = Instance.new("AudioDeviceInput", player)
input.Player = player
-- Connect each player's input to the global listener
connect(input, globalListener)
end
players.PlayerAdded:Connect(onPlayerAdded)
for _, player in players:GetPlayers() do
onPlayerAdded(player)
end
Would appreciate a solution!