voicechat.outgoingpacket:Once Asynchronous

Subscribe to one outbound packet attempt and automatically disconnect after the event is queued for delivery.

Syntax
Luau
voicechat.outgoingpacket:Once(callback: (VoicePacket) -> ()) -> VoicePacketConnection

Parameters

Call this method with a voicechat.outgoingpacket receiver. The colon supplies self implicitly; a dot call must pass the receiver explicitly.

Function parameters
ParameterTypeDescription
callback(VoicePacket) -> ()Function receiving a VoicePacket table.

Argument fields

VoicePacket fields
Luau
VoicePacket = {
  Data: buffer, Channel: "data" | "rtp",
  Direction: "outgoing" | "incoming",
  Injected: boolean, Accepted: boolean
}

Returns

VoicePacketConnection

A connection with Connected and Disconnect.

VoicePacketConnection fields
Luau
VoicePacketConnection = {Connected: boolean, Disconnect: Function}

Usage notes

The callback runs later through task.defer. Channel is data or rtp.

Example

Example
Luau
voicechat.outgoingpacket:Once(function(packet)
    print(packet.Channel, packet.Accepted)
end)