Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A Script is a type of Lua code container that will run its contents on the server. By default, Scripts have print("Hello, world") as their contents. The instant that the following conditions are met, a Script’s Lua code is run in a new thread:
- Disabled property is false
- The Script object is a descendant of the Workspace or
- ServerScriptService
- 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).
- It has access to server-side objects, properties and events. For example, Scripts can award badges to players using BadgeService, while a LocalScript on the client cannot. Actions taken by LocalScripts that are not replicated (due to Workspace.FilteringEnabled) will not be visible to Scripts.
- Properties
- ProtectedString
- Source
- The code to be executed
- Inherited from BaseScript:
- Hide
- bool
- Disabled
- Determines whether a BaseScript will run or not.
- Inherited from LuaSourceContainer:
- Hide
- Instance
- CurrentEditor
- [notscriptable]
- The Player who is currently editing this script. This property is only used when in Team Create mode.
- Inherited from Instance:
- Hide
- bool
- Archivable
- Determines if an Instance can be cloned using Instance:Clone or saved to file.
- string
- ClassName
- [readonly] [notreplicated]
- A read-only string representing the class this Instance belongs to
- string
- Name
- A non-unique identifier of the Instance
- Instance
- Parent
- Determines the hierarchical parent of the Instance
- bool
- RobloxLocked
- If true, the Instance and its descendants cannot be indexed or edited by a Script or LocalScript and will throw an error if it is attempted
- Functions
- string
- GetHash ( )
- Returns a hash of the script’s source
- Inherited from Instance:
- Hide
- void
- ClearAllChildren ( )
- This function destroys all of an Instance's children.
- Instance
- Clone ( )
- Create a deep copy of a Roblox instance and descendants where Archivable = true.
- void
- Destroy ( )
- Sets the Instance.Parent property to nil, locks the Instance.Parent property, disconnects all connections and calls Destroy on all children.
- Instance
- FindFirstAncestor ( string name )
- Returns the first ancestor of the Instance whose Instance.Name is equal to the given name.
- Instance
- FindFirstAncestorOfClass ( string className )
- Returns the first ancestor of the Instance whose Instance.ClassName is equal to the given className.
- Instance
- FindFirstAncestorWhichIsA ( string className )
- Returns the first ancestor of the Instance for whom Instance:IsA returns true for the given className.
- Instance
- FindFirstChild ( string name , bool recursive )
- Returns the first child of the Instance found with the given name.
- Instance
- FindFirstChildOfClass ( string className )
- Returns the first child of the Instance whose ClassName is equal to the given className.
- Instance
- FindFirstChildWhichIsA ( string className , bool recursive )
- Returns the first child of the Instance for whom Instance:IsA returns true for the given className.
- Variant
- GetAttribute ( string attribute )
- RBXScriptSignal
- GetAttributeChangedSignal ( string attribute )
- Dictionary
- GetAttributes ( )
- Objects
- GetChildren ( )
- Returns an array containing all of the Instance's children.
- string
- GetDebugId ( int scopeLength )
- [notbrowsable]
- Returns a coded string of the Instances DebugId used internally by Roblox.
- Array
- GetDescendants ( )
- [customluastate]
- Returns an array containing all of the descendants of the instance
- string
- GetFullName ( )
- Returns a string describing the Instance's ancestry.
- RBXScriptSignal
- GetPropertyChangedSignal ( string property )
- Get an event that fires when a given property of an object changes.
- bool
- IsA ( string className )
- [customluastate]
- Returns true if an Instance's class matches or inherits from a given class
- bool
- IsAncestorOf ( Instance descendant )
- Returns true if an Instance is an ancestor of the given descendant.
- bool
- IsDescendantOf ( Instance ancestor )
- Returns true if an Instance is a descendant of the given ancestor.
- void
- SetAttribute ( string attribute , Variant value )
- Instance
- WaitForChild ( string childName , double timeOut )
- [customluastate] [canyield]
- Returns the child of the Instance with the given name. If the child does not exist, it will yield the current thread until it does.
- Events
- Inherited from Instance:
- Hide
- RBXScriptSignal
- AncestryChanged ( Instance child , Instance parent )
- Fires when the Instance.Parent property of the object or one of its ancestors is changed.
- RBXScriptSignal
- AttributeChanged ( string attribute )
- RBXScriptSignal
- Changed ( string property )
- Fired immediately after a property of an object changes.
- RBXScriptSignal
- ChildAdded ( Instance child )
- Fires when an object is parented to this Instance.
- RBXScriptSignal
- ChildRemoved ( Instance child )
- Fires when a child is removed from this Instance.
- RBXScriptSignal
- DescendantAdded ( Instance descendant )
- Fires when a descendant is added to the Instance
- RBXScriptSignal
- DescendantRemoving ( Instance descendant )
- Fires immediately before a descendant of the Instance is removed.
- Code Samples
- Hello World
- A Lua example of the classic hello world program. When run, it displays the simple message to the Output in Roblox Studio. By default, Script and LocalScript objects contain this code when they are first created.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement