|
|
(9 intermediate revisions by 4 users not shown) |
Line 1: |
Line 1: |
| {{CatUp|Scripting}}
| | #redirect [[RBX.lua.Instance (Object)]] |
| __TOC__
| |
| | |
| ==Instance==
| |
| | |
| The Instance table offers several functions in order to create/manipulate ROBLOX created objects.
| |
| | |
| ==Creating Objects==
| |
| | |
| Creating objects is very simple, you can find a list of objects in the [[Class_reference|Class Reference]] section of the Wiki. You must pass in the name of the object, and it will return that object.
| |
|
| |
| {{CodeExample}}
| |
| print(Instance.new("Part"))
| |
| </pre>
| |
| | |
| Will result in:
| |
| {{CodeExample}}
| |
| Part
| |
| </pre>
| |
| | |
| {{LeftNoticeStart}}
| |
| By default, all objects are parented to nil. If you have an object such as Part that is rendered, remember to parent it to the Workspace in order for it to be rendered.
| |
| | |
| You can pass a second argument to Instance.new to parent the object to it:
| |
| | |
| {{Example|
| |
| <pre>Instance.new("Part", workspace)</pre>
| |
| Creates a Part and sets its parent to Workspace.
| |
| }}
| |
| |}
| |
| | |
| ==[[Functions]]==
| |
| | |
| | |
| {|border="1" cellspacing="5" style=" -webkit-border-radius: 4px; -moz-border-radius: 4px; height: 100%; background-color: #FFFFFF; border-top: dashed 2px #ff0000; border-left: dashed 2px #ff0000; border-bottom: dashed 2px #aa0000; border-right: dashed 2px #aa0000; margin: 6px; margin-right: 10px; margin-left: 10px; clear: none; padding: 2px;"
| |
| ! Function !! Description
| |
| |-
| |
| | Instance.new('''val'''[, '''parent''']) || Returns a new object of the class named by '''val'''. The '''parent''' argument is optional; if it is supplied the object will be parented to it.
| |
| |-
| |
| | Instance.Lock('''val''', '''player''') || Sets a network enabled mutex for object val targeted at player.
| |
| |-
| |
| | Instance.Unlock('''val''') || Removes the network enabled mutex for object val.
| |
| |-
| |
| |}
| |