Skip to main content
Opens a new communication channel, then hands back its id and event.
Scripts running on different actor threads (e.g. through run_on_actor) don’t share _G or shared, so they . Used to open the bridge for that case: call create_comm_channel() on one side, send the returned id to the other side, and both sides talk over the same event.. Used to open the bridge for that case: call create_comm_channel() on one side, send the returned id to the other side, and both sides talk over the same event. The second return value is a Roblox BindableEvent. Use :Fire(...) to send a message. Use .Event:Connect(...) to receive one, or .Event:Wait() to yield until the next message arrives.

Returns

A tuple: Both values are nil if the channel could not be opened.

Example

The main thread opens a channel and starts a run_on_actor with the id. The worker thread fires a message back, and the main thread catches it on .Event:Connect.
The id is just a number, so the other thread learns it by being handed it. The simplest way is to pass it as one of the ... arguments of run_on_actor(actor, script, ...) when you start the worker thread.