Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.
PluginConnection
Inherits from: Object
Studio plugins run in each Studio data model that the user opens, including both edit and playtest data models. PluginConnection objects allow these instances of the same plugin to communicate across data model boundaries. Messages sent by PluginConnection:SendMessage() will be received in the remote data model via the callback the same plugin registers with PluginConnection:BindToMessage(). Each PluginConnection object can both send and receive messages while connected, and messages will be received reliably and in order unless the connection drops (e.g. due to the remote data model shutting down) before their receipt.
Note that although multiple plugins may share the same PluginConnection object, they each have their own internal connection; each plugin will receive only its own messages in its callback to BindToMessage(), even if other plugins call SendMessage().
Inherits from: Object
Memory category: Instances
Tags: NotCreatable, NotReplicated
Properties
| Name | Type / Returns | Description |
|---|---|---|
| PluginConnection.Connected | boolean | Whether this PluginConnection object is still connected. |
| PluginConnection.TargetId | string | A unique ID for the target data model. |
| PluginConnection.Type | PluginConnectionTargetType | This PluginConnectionTargetType describes the relationship of the target data model to the current one. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object.ClassName | string | A read-only string representing the class this Object belongs to. |
| Object.className | string |
PluginConnection.Connected
If true, then this PluginConnection remains connected to the target data model, and it is still possible to send messages to that data model and receive them from it. If false, then the connection has been lost. Once disconnected, PluginConnection objects cannot reconnect, so a value of false here indicates it is now safe to discard the PluginConnection object.
| Field | Value |
|---|---|
| type | boolean |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"PluginSecurity","write":"PluginSecurity"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":false,"can_save":false} |
PluginConnection.TargetId
This string contains a globally unique identifier for the target data model, which will be the same for any two plugin connections that target the same data model (even if those connections originate from different data models). This property is immutable.
| Field | Value |
|---|---|
| type | string |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"PluginSecurity","write":"PluginSecurity"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":false,"can_save":false} |
PluginConnection.Type
This PluginConnectionTargetType describes the relationship of the target data model to the current data model. For example, a value of PluginConnectionTargetType.Test means that the target data model is a playtest data model spawned from this data model. Alternatively, a value of PluginConnectionTargetType.Edit means the target data model is the edit session which spawned this test data model. This property is immutable.
| Field | Value |
|---|---|
| type | PluginConnectionTargetType |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"PluginSecurity","write":"PluginSecurity"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":false,"can_save":false} |
Methods
| Name | Type / Returns | Description |
|---|---|---|
| PluginConnection:BindToMessage | RBXScriptConnection | Binds a callback to this PluginConnection to receive messages from SendMessage(). |
| PluginConnection:SendMessage | () | Sends a payload to the remote data model. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object:GetPropertyChangedSignal | RBXScriptSignal | Get an event that fires when a given property of the object changes. |
| Object:IsA | boolean | Returns true if an object's class matches or inherits from a given class. |
| Object:isA | boolean |
PluginConnection:BindToMessage
This function binds a callback to this connection, which will be called when the connection receives a message from the current plugin running in the remote data model. The message passed to the callback will be the same as the one the plugin passed to SendMessage(). The PluginConnection will buffer any messages received before the plugin calls BindToMessage() and deliver them immediately when the plugin does call BindToMessage(). Each plugin may only bind one callback at a time.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| callback | Function | A function accepting a string or a buffer which will be called when this PluginConnection receives a message. |
Returns
| Type | Description |
|---|---|
| RBXScriptConnection | A RBXScriptConnection representing the binding of this callback to the PluginConnection. Disconnect it to disconnect this callback from the connection. |
| Field | Value |
|---|---|
| security | PluginSecurity |
| thread safety | Unsafe |
PluginConnection:SendMessage
This function transmits a string or buffer to the remote data model. The callback registered in BindToMessage() by the instance of the current plugin running in the remote data model will be called asynchronously with the message as its argument.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| message | Variant | The string or buffer to be sent. |
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| security | PluginSecurity |
| thread safety | Unsafe |
Events
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object.Changed | Fires immediately after a property of the object changes, with some limitations. |