> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# create_comm_channel

> 使用 Instance.new 创建新的 BindableEvent，将它的 Instance reference 以 numeric channel ID 存入 communication channel list，并返回该 ID 和 BindableEvent Instance。channel ID 由 current map size plus one 计算。如果 Instance.new("BindableEvent") 没有在 stack 上留下 object value，该 function 会抛出 "Failed to make a BindableEvent"。

<div className="real-function-page">
  ```lua theme={null}
  create_comm_channel(): integer | Instance
  ```

  ## 返回值

  <ResponseField name={"channelId"} type={"integer"}>
    插入 communication channel list 的 numeric channel ID。
  </ResponseField>

  <ResponseField name={"event"} type={"Instance"}>
    为 channel 保存并返回给 caller 的 BindableEvent Instance。
  </ResponseField>

  ## 示例

  Create a BindableEvent communication channel and keep the returned channel ID for later lookup.

  ```lua theme={null}
  local channelId, event = create_comm_channel()

  print(channelId)
  print(event)
  ```
</div>
