Advertisement
lRainTrainl

How to script

Dec 21st, 2019
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.61 KB | None | 0 0
  1. 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:
  2.  
  3. Disabled property is false
  4. The Script object is a descendant of the Workspace or
  5. ServerScriptService
  6. 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).
  7.  
  8. 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.
  9.  
  10. Properties
  11. ProtectedString
  12. Source
  13. The code to be executed
  14.  
  15. Inherited from BaseScript:
  16. Hide
  17. bool
  18. Disabled
  19. Determines whether a BaseScript will run or not.
  20.  
  21. Inherited from LuaSourceContainer:
  22. Hide
  23. Instance
  24. CurrentEditor
  25. [notscriptable]
  26. The Player who is currently editing this script. This property is only used when in Team Create mode.
  27.  
  28. Inherited from Instance:
  29. Hide
  30. bool
  31. Archivable
  32. Determines if an Instance can be cloned using Instance:Clone or saved to file.
  33.  
  34. string
  35. ClassName
  36. [readonly] [notreplicated]
  37. A read-only string representing the class this Instance belongs to
  38.  
  39. string
  40. Name
  41. A non-unique identifier of the Instance
  42.  
  43. Instance
  44. Parent
  45. Determines the hierarchical parent of the Instance
  46.  
  47. bool
  48. RobloxLocked
  49. 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
  50.  
  51. Functions
  52. string
  53. GetHash ( )
  54. Returns a hash of the script’s source
  55.  
  56. Inherited from Instance:
  57. Hide
  58. void
  59. ClearAllChildren ( )
  60. This function destroys all of an Instance's children.
  61.  
  62. Instance
  63. Clone ( )
  64. Create a deep copy of a Roblox instance and descendants where Archivable = true.
  65.  
  66. void
  67. Destroy ( )
  68. Sets the Instance.Parent property to nil, locks the Instance.Parent property, disconnects all connections and calls Destroy on all children.
  69.  
  70. Instance
  71. FindFirstAncestor ( string name )
  72. Returns the first ancestor of the Instance whose Instance.Name is equal to the given name.
  73.  
  74. Instance
  75. FindFirstAncestorOfClass ( string className )
  76. Returns the first ancestor of the Instance whose Instance.ClassName is equal to the given className.
  77.  
  78. Instance
  79. FindFirstAncestorWhichIsA ( string className )
  80. Returns the first ancestor of the Instance for whom Instance:IsA returns true for the given className.
  81.  
  82. Instance
  83. FindFirstChild ( string name , bool recursive )
  84. Returns the first child of the Instance found with the given name.
  85.  
  86. Instance
  87. FindFirstChildOfClass ( string className )
  88. Returns the first child of the Instance whose ClassName is equal to the given className.
  89.  
  90. Instance
  91. FindFirstChildWhichIsA ( string className , bool recursive )
  92. Returns the first child of the Instance for whom Instance:IsA returns true for the given className.
  93.  
  94. Variant
  95. GetAttribute ( string attribute )
  96. RBXScriptSignal
  97. GetAttributeChangedSignal ( string attribute )
  98. Dictionary
  99. GetAttributes ( )
  100. Objects
  101. GetChildren ( )
  102. Returns an array containing all of the Instance's children.
  103.  
  104. string
  105. GetDebugId ( int scopeLength )
  106. [notbrowsable]
  107. Returns a coded string of the Instances DebugId used internally by Roblox.
  108.  
  109. Array
  110. GetDescendants ( )
  111. [customluastate]
  112. Returns an array containing all of the descendants of the instance
  113.  
  114. string
  115. GetFullName ( )
  116. Returns a string describing the Instance's ancestry.
  117.  
  118. RBXScriptSignal
  119. GetPropertyChangedSignal ( string property )
  120. Get an event that fires when a given property of an object changes.
  121.  
  122. bool
  123. IsA ( string className )
  124. [customluastate]
  125. Returns true if an Instance's class matches or inherits from a given class
  126.  
  127. bool
  128. IsAncestorOf ( Instance descendant )
  129. Returns true if an Instance is an ancestor of the given descendant.
  130.  
  131. bool
  132. IsDescendantOf ( Instance ancestor )
  133. Returns true if an Instance is a descendant of the given ancestor.
  134.  
  135. void
  136. SetAttribute ( string attribute , Variant value )
  137. Instance
  138. WaitForChild ( string childName , double timeOut )
  139. [customluastate] [canyield]
  140. 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.
  141.  
  142. Events
  143. Inherited from Instance:
  144. Hide
  145. RBXScriptSignal
  146. AncestryChanged ( Instance child , Instance parent )
  147. Fires when the Instance.Parent property of the object or one of its ancestors is changed.
  148.  
  149. RBXScriptSignal
  150. AttributeChanged ( string attribute )
  151. RBXScriptSignal
  152. Changed ( string property )
  153. Fired immediately after a property of an object changes.
  154.  
  155. RBXScriptSignal
  156. ChildAdded ( Instance child )
  157. Fires when an object is parented to this Instance.
  158.  
  159. RBXScriptSignal
  160. ChildRemoved ( Instance child )
  161. Fires when a child is removed from this Instance.
  162.  
  163. RBXScriptSignal
  164. DescendantAdded ( Instance descendant )
  165. Fires when a descendant is added to the Instance
  166.  
  167. RBXScriptSignal
  168. DescendantRemoving ( Instance descendant )
  169. Fires immediately before a descendant of the Instance is removed.
  170.  
  171. Code Samples
  172. Hello World
  173. 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