Skip to content
Saiko

create_comm_channel

Creates a communication channel between the main state and actor states. Returns its numeric id and an event object: the main state listens on .Event and an actor fires into it after looking the channel up by id.

Signature

luau
create_comm_channel(): (number, BindableEvent)

Returns

(number, BindableEvent)

Note

Example

luau
local id, channel = create_comm_channel()

channel.Event:Connect(function(message, inst)
    print("from the actor:", message, inst) --> from the actor: hello Workspace
end)

run_on_actor(getactors()[1], [[
    local channel = get_comm_channel(...)
    channel:Fire("hello", workspace)
]], id)