Reference API Roblox

Engine API

Website

Related

Reference API Roblox

BaseScript

The base class for all script objects which run automatically.

This class is not creatable. Instances of this class cannot be created with Instance.new.
Tags: [NotCreatable]

Member index 4

HistoryMember
731Disabled: bool
731Enabled: bool
731LinkedSource: ContentId
731RunContext: RunContext
inherited from LuaSourceContainer
inherited from Instance
731Archivable: bool
731Capabilities: SecurityCapabilities
731IsInSandbox: bool
731Name: string
731Parent: Instance
731PredictionMode: PredictionMode
731Sandboxed: bool
731UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
707GetDescendants(): Instances
486GetFullName(): string
706GetStyled(name: string, selector: string?): Variant
657GetStyledPropertyChangedSignal(property: string): RBXScriptSignal
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
664IsPropertyModified(property: string): bool
698QueryDescendants(selector: string): Instances
573Remove(): null
576RemoveTag(tag: string): null
664ResetPropertyToDefault(property: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
731children(): Instances
731clone(): Instance
731destroy(): null
731findFirstChild(name: string, recursive: bool = false): Instance
731getChildren(): Instances
731isDescendantOf(ancestor: Instance): bool
731remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
657StyledPropertiesChanged()
731childAdded(child: Instance)
inherited from Object
731ClassName: string
731className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
731isA(className: string): bool
647Changed(property: string)

Description

The base class for all script objects which run automatically.

History 25

Members 4

Disabled

TypeDefault
bool

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.

History 6

Enabled

TypeDefault
bool

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.

This property is not replicated. Its interface does not cross the network boundary.

History 4

Tags: [NotReplicated]

LinkedSource

TypeDefault
ContentId

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.

1
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.

This property is deprecated. It exists only for backward compatibility, and should not be used for new work.

History 8

Tags: [Deprecated]

RunContext

TypeDefault
RunContext

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.

History 5

Settings