Syntax
create_comm_channel(): integer | InstanceReturns
| Name | Type | Description |
|---|---|---|
channelId | integer | Numeric channel ID inserted into the communication channel list. |
event | Instance | BindableEvent Instance stored for the channel and returned to the caller. |
Description
Creates a new BindableEvent with Instance.new, stores its Instance reference in the communication channel list under a numeric channel ID, and returns the ID plus the BindableEvent Instance. The channel ID is computed from the current map size plus one. If Instance.new("BindableEvent") does not leave a object value on the stack, the function raises "Failed to make a BindableEvent".
Call it without parameters. The function reads the needed context from the current runtime state.
It returns channelId (integer), event (Instance). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Create a BindableEvent communication channel and keep the returned channel ID for later lookup.
local channelId, event = create_comm_channel()
print(channelId)
print(event)