Roblox UtilitiesDevlHub Roblox Documentation

Class

BaseScript

NotCreatable
Memory category
Script
Subclasses
1

The base class for all script objects which run automatically.

The base class for all script objects which run automatically.

Properties 4#

DisabledbooleanDetermines whether a BaseScript runs or not.ReadSafe
EnabledbooleanDetermines whether a BaseScript runs or not.ReadSafeNotReplicated
LinkedSourceContentIdThe content ID of an uploaded script. When set binds the uploaded code to the script's Script.Source.ReadSafeDeprecated
RunContextRunContextDetermines the context under which the script runs.ReadSafe

Disabled: boolean#

ReadSafe

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: boolean#

NotReplicatedReadSafe

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.

LinkedSource: ContentId#

DeprecatedReadSafeDeprecated

Deprecated. This property is now replaced by packages which has greater functionality.

The content ID of an uploaded script. When set binds the uploaded code to the script's Script.Source.

By default, this property is set to '[Embedded]'. This means the source of the script is not linked to an upload script and is instead written in the script.

Luau
script.LinkedSource = "http://www.roblox.com/asset/?id=1014476" -- link source

Developers should remove a linked source via the properties window, rather than setting the property to '[Embedded]'.

For the LinkedSource property for ModuleScripts, please see ModuleScript.LinkedSource.

RunContext: RunContext#

ReadSafe

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.

Inherited members#

Inherited from Instance 58
Inherited from Object 6
Properties (2)

ClassName, className

Events (1)

Changed

Subclasses 1#