network.receive
Injects a packet into the local receive path.
Syntax
Signature
network.receive(Payload: Packet | table | string | buffer) -> (boolean, string?)Aliases
raknet.receivepackets.receiveRakNet.receive
Parameters
| Parameter | Type | Description |
|---|---|---|
Payload | Packet | table | string | buffer | Payload accepted by network.encode. |
Returns
| Type | Description |
|---|---|
boolean | Whether 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.