Script
A Script is a Lua code 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 Enabled property is true.
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.
Summary
Properties
Methods
Events
Properties
Source
A script's Source is the code to be executed. This item is protected and attempting to access it in a Script or LocalScript will cause an error.
If you want to read or modify a script that the user has open, consider using ScriptEditorService to interact with the Script Editor instead. Alternatively, you can read Source from the command line.