apex.ipc.send
Sends values to one instance or broadcasts them to the other ready instances under a topic.
Syntax
apex.ipc.send(target: (Peer | number | string)?, topic: string, ...: any) -> (boolean | number, string?)
Parameters
| Parameter | Type | Description |
|---|---|---|
target | Peer, number, string or nil | A receiving instance, or nil to send to the other instances. |
topic | string | 1 to 128 bytes. Topics are yours to choose; ones starting with @ are reserved for Apex events. |
... | any | The values to send. |
Returns
| Type | Description |
|---|---|
boolean or number | For one target, true when handed to Apex or false on failure. For nil, the number of other ready instances when queued, or 0 if none are ready or the broadcast could not be queued. |
string? | Why it was not sent: the target is not in a game, or messages are arriving faster than the target reads them. |
Description
The receiver gets them through apex.ipc.on as (peer, ...), where peer is the sender. Pass nil to broadcast to every other ready instance. The sender does not receive its own broadcast. Messages from one sender arrive in the order they were sent, at most a frame later in a game running at normal speed.
Values are copied, not shared: nil, booleans, numbers, strings, buffers, vectors, tables, Vector3, Vector2, Color3, CFrame, UDim, UDim2 and EnumItem. Table keys must be strings, numbers or booleans; metatables are not sent; a table that contains itself, or tables nested more than 64 deep, are refused. Instances, functions and threads cannot cross between games: send something that identifies them, such as a path or a name. A message holds at most 512 KiB of values.
A value that cannot be sent raises an error. A target that is not in a game is not an error: send returns false and the reason.
Example
local ok, why = apex.ipc.send("FarmAccount2", "goto", Vector3.new(10, 5, -20), { speed = 16 })
if not ok then
warn(why)
end
Notes
- Messages are not stored: an instance that is not in a game when a message is sent never receives it. Keep state that late arrivals need in
apex.ipc.shared.
These are Game executor contracts. Check build requirements and session lifetimes before using them.
