BaseScript

Show Deprecated
Not Creatable

The base class for all script objects which run automatically.

Summary

Properties

Determines whether a BaseScript will run or not.

NOT REPLICATED

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

Determines the context under which the script will run.

Events

Methods

Properties

Disabled

Determines whether a BaseScript will run or not.

Scripts and LocalScripts will run when Disabled is false.

If Disabled is set to true while a script is running, the current thread will be terminated.

If Disabled is set to true from false, the script will run again. This means the Disabled property can be toggled to restart a script:


1scriptObject.Disabled = false
2scriptObject.Disabled = true
3

Note, the above code snippet cannot be used within the script itself. This is because once the script is disabled the thread will terminate.

Enabled

Not Replicated

LinkedSource

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.


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

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

Determines the context under which the script will run.

When using the Legacy RunContext scripts will only run when parented to certain containers dependent on whether they are a Script or LocalScript.

If RunContext is assigned while the script is running any threads created by the script will be terminated and the script will start running under the new context if possible.

Note, RunContext cannot be used from a LocalScript.

Events

Methods