ReferenceMulti-instance

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

ParameterTypeDescription
targetPeer, number, string or nilA receiving instance, or nil to send to the other instances.
topicstring1 to 128 bytes. Topics are yours to choose; ones starting with @ are reserved for Apex events.
...anyThe values to send.

Returns

TypeDescription
boolean or numberFor 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

These are Game executor contracts. Check build requirements and session lifetimes before using them.