create_comm_channel Synchronous
Create a communication channel and keep its numeric ID for code running in another state. The returned receiver also lets this script subscribe to or fire the same channel.
Luau
create_comm_channel() -> (id: number, receiver: CommChannel)Parameters
This function takes no arguments.
Returns
(id: number, receiver: CommChannel)Two values: the channel ID and a CommChannel receiver.
Luau
CommChannel = {Event: RBXScriptSignal, Internal: BindableEvent}Usage notes
Keep the ID if another state needs to look up the channel with get_comm_channel.
Example
Luau
local id, channel = create_comm_channel()
local connection = channel:Connect(function(message)
print("Received:", message)
end)
channel:Fire("ready")
connection:Disconnect()
print("Channel ID:", id)