network.receive

Injects a packet into the local receive path.

Syntax

Signature
network.receive(Payload: Packet | table | string | buffer) -> (boolean, string?)

Aliases

  • raknet.receive
  • packets.receive
  • RakNet.receive

Parameters

ParameterTypeDescription
PayloadPacket | table | string | bufferPayload accepted by network.encode.

Returns

TypeDescription
booleanWhether submission succeeded.
string?Failure message when the result is false.

Notes

It accepts the same payload forms as network.encode. Success reports acceptance by that path and does not confirm that gameplay handled the packet.

Example

Luau
if not network.isavailable() then
    warn("Packet transport is unavailable")
    return
end

local Packet = network.create("Pong", {value = 12345})
local Success, Error = network.receive(Packet)
if not Success then
    warn("Receive injection failed:", Error)
end
-- This injects locally. It does not send anything to the server.