voicechat. incomingpacket: Once Asynchronous
Subscribe to one inbound culling or RTP packet and automatically disconnect after it is queued for delivery.
Luau
voicechat.incomingpacket:Once(callback: (VoicePacket) -> ()) -> VoicePacketConnectionParameters
Call this method with a voicechat.incomingpacket 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 may yield because it is deferred.
Example
Luau
voicechat.incomingpacket:Once(function(packet)
print(packet.Channel)
end)