Skip to content

Class · inherits LuaSourceContainer

BaseScript

Official docs ↗

The base class for all script objects which run automatically.

About BaseScript

The base class for all script objects which run automatically.

Properties 3

  • Disabled: booleanDetermines whether a BaseScript runs or not.

    Determines whether a BaseScript runs or not.

    Setting this property to true while the script is running drops its references to the script's thread; a thread that is yielded (or that yields later) is never resumed and becomes eligible for garbage collection. A thread that is actively executing continues to run until it next yields or returns.

    If this property is changed from true to false, a fresh run of the script is started. This means that Disabled can be toggled to restart a script.

  • Enabled: booleanNotReplicatedDetermines whether a BaseScript runs or not.

    Determines whether a BaseScript runs or not. We recommend this property over the similar but opposite Disabled.

    Setting this property to false while the script is running drops its references to the script's thread; a thread that is yielded (or that yields later) is never resumed and becomes eligible for garbage collection. A thread that is actively executing continues to run until it next yields or returns.

    If this property is changed from false to true, a fresh run of the script is started. This means that Enabled can be toggled to restart a script.

  • RunContext: RunContextDetermines the context under which the script runs.

    Determines the context under which the script runs. Only available for Scripts, not LocalScripts.

    When set to Legacy, Scripts only run when parented to certain containers. See Script types and locations.

    If RunContext is assigned while the script is running, the engine drops its references to that thread, and a fresh run of the script is started under the new context (if possible). A thread that is actively executing continues to run until it next yields or returns.

BaseScript also has every member of LuaSourceContainer. Deprecated and Roblox-only members are hidden.

Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.