Instance: Difference between revisions
>Blocco Fixing location of bracket |
>Ozzypig |
||
Line 4: | Line 4: | ||
==Instance== | ==Instance== | ||
The Instance table offers several functions in order to create/manipulate ROBLOX created objects. | In ROBLOX, an Instance is an object in a ROBLOX game. ROBLOX Lua has a global table called '''Instance''' for changing how objects in the game behave. The Instance table offers several functions in order to create/manipulate ROBLOX created objects. It is best known for the '''Instance.new()''' function. | ||
==Creating Objects== | ==Creating Objects== |
Revision as of 13:39, 24 December 2010
Instance
In ROBLOX, an Instance is an object in a ROBLOX game. ROBLOX Lua has a global table called Instance for changing how objects in the game behave. The Instance table offers several functions in order to create/manipulate ROBLOX created objects. It is best known for the Instance.new() function.
Creating Objects
Creating objects is very simple, you can find a list of objects in the Class Reference section of the Wiki. You must pass in the name of the object, and it will return that object.
Template:CodeExample print(Instance.new("Part"))
Will result in: Template:CodeExample Part
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
Instance.new("Part", workspace) Creates a Part and sets its parent to Workspace. |
Functions
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. |