Class · inherits BaseScript
Script
An object that contains and runs Luau code on the server.
About Script
A Script is a Luau source container that can access server-side
objects, properties, and events, such as to award badges to players using
BadgeService, while LocalScripts on the client
cannot.
The instant that the following conditions are met, a script's code is run in a new thread:
- Its
Enabledproperty istrue. - The
Scriptobject is a descendant of theWorkspaceorServerScriptService.
The script will continue to run until the above conditions are not met, it
terminates, or it raises an error (unless that error is raised by a function
connected to some event that is firing). Additionally, the thread will be
stopped if the script or one of its ancestors is destroyed. A script will
continue to run even if the Parent property is set to
nil and the Script is not destroyed.
Properties 1
Source
: ProtectedStringThe code to be executed.Represents the code to be executed. It's protected and discouraged for editing directly. Attempting to access this property in a
ScriptorLocalScriptcauses errors.If you want to read or modify the source of a script that a user has open, use
ScriptEditorServiceto interact with the Script Editor rather than directly modifying this property. BothScriptEditorService.UpdateSourceAsyncandScriptEditorService.GetEditorSourcecan read or modify script content from the script editor if the script is opened. You can also read the source from the command line.
Script also has every member of BaseScript. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.