Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.
RunContext
The RunContext enum is used with the BaseScript.RunContext property to specify the context in which a Script executes. The default value is RunContext.Legacy, which preserves the original container-based behavior where a Script runs on the server and a LocalScript runs on the client depending on its placement in the instance hierarchy.
Setting a non-Legacy value allows a Script to run explicitly on the server, client, or as plugin code, regardless of container placement. LocalScript objects cannot use this property — only Script objects support non-Legacy run contexts.
Changing this property while the script is running terminates any active threads and restarts the script under the new context if conditions permit.
Items
| Name | Value | Description |
|---|---|---|
| Legacy | 0 | Runs with legacy container-based behavior that depends on the script type, such as LocalScript or Script. |
| Server | 1 | Runs on the server. |
| Client | 2 | Runs on the client. |
| Plugin | 3 | Runs as a descendant of Plugin instances. |
Legacy
Runs with legacy container-based behavior that depends on the script type, such as LocalScript or Script.
| Field | Value |
|---|---|
| value | 0 |
Server
Runs on the server.
| Field | Value |
|---|---|
| value | 1 |
Client
Runs on the client.
| Field | Value |
|---|---|
| value | 2 |
Plugin
Runs as a descendant of Plugin instances.
| Field | Value |
|---|---|
| value | 3 |