voicechat. outgoingpacket: Once Asynchronous
Subscribe to one outbound packet attempt and automatically disconnect after the event is queued for delivery.
Luau
voicechat.outgoingpacket:Once(callback: (VoicePacket) -> ()) -> VoicePacketConnectionParameters
Call this method with a voicechat.outgoingpacket receiver. The colon supplies self implicitly; a dot call must pass the receiver explicitly.
| Parameter | Type | Description |
|---|---|---|
callback | (VoicePacket) -> () | Function receiving a VoicePacket table. |
Argument fields
Luau
VoicePacket = {
Data: buffer, Channel: "data" | "rtp",
Direction: "outgoing" | "incoming",
Injected: boolean, Accepted: boolean
}Returns
VoicePacketConnectionA connection with Connected and Disconnect.
Luau
VoicePacketConnection = {Connected: boolean, Disconnect: Function}Usage notes
The callback runs later through task.defer. Channel is data or rtp.
Example
Luau
voicechat.outgoingpacket:Once(function(packet)
print(packet.Channel, packet.Accepted)
end)