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
553Disabled: bool
553Enabled: bool
645LinkedSource: ContentId
566RunContext: RunContext
inherited from LuaSourceContainer
inherited from Instance
553Archivable: bool
635Capabilities: SecurityCapabilities
553ClassName: string
553Name: string
553Parent: Instance
635Sandboxed: bool
616UniqueId: UniqueId
553className: string
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
486GetChildren(): Objects
462GetDebugId(scopeLength: int = 4): string
486GetDescendants(): Array
486GetFullName(): string
462GetPropertyChangedSignal(property: string): RBXScriptSignal
641GetStyled(name: string): Variant
576GetTags(): Array
576HasTag(tag: string): bool
486IsA(className: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
580IsPropertyModified(name: string): bool
573Remove(): null
576RemoveTag(tag: string): null
580ResetPropertyToDefault(name: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
553children(): Objects
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
553getChildren(): Objects
462isA(className: string): bool
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462Changed(property: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
553childAdded(child: Instance)

Description

The base class for all script objects which run automatically.

History 17

Members 4

Disabled

TypeDefault
bool

Determines whether a BaseScript will run or not.

If a script is disabled by changing this property to true while the script is running, the current running thread of the script will be terminated.

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

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

Note that the above code snippet cannot be used within the script itself, since disabling the script from within itself will terminate the thread and the line to reenable it will never execute.

History 4

Enabled

TypeDefault
bool

Determines whether a BaseScript will run or not. This should be used in favor of the similar but opposite Disabled property.

If a script is disabled by changing this property to false while the script is running, the current running thread of the script will be terminated.

If this property is changed from false to true, the script will run again. This means that Enabled can be toggled to restart a script:

1
2
scriptObject.Enabled = false
scriptObject.Enabled = true

Note that the above code snippet cannot be used within the script itself, since disabling the script from within itself will terminate the thread and the line to reenable it will never execute.

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

History 2

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 6

Tags: [Deprecated]

RunContext

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

History 3

Settings