Class
BaseScript
NotCreatable
The base class for all script objects which run automatically.
The base class for all script objects which run automatically.
Properties 4#
Disabledboolean | Determines whether a BaseScript runs or not.ReadSafe |
Enabledboolean | Determines whether a BaseScript runs or not.ReadSafeNotReplicated |
LinkedSourceContentId | The content ID of an uploaded script. When set binds the uploaded code to
the script's Script.Source.ReadSafeDeprecated |
RunContextRunContext | Determines 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.
script.LinkedSource = "http://www.roblox.com/asset/?id=1014476" -- link sourceDevelopers 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
Properties (10)
Archivable, archivable, Capabilities, IsInSandbox, Name, Parent, PredictionMode, RobloxLocked, Sandboxed, UniqueId
Methods (39)
AddTag, children, ClearAllChildren, Clone, clone, Destroy, destroy, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, findFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, FindFirstDescendant, GetActor, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, getChildren, GetDebugId, GetDescendants, GetFullName, GetStyled, GetStyledPropertyChangedSignal, GetTags, HasTag, IsAncestorOf, IsDescendantOf, isDescendantOf, IsPropertyModified, QueryDescendants, Remove, remove, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild