Instance

From Legacy Roblox Wiki
Revision as of 19:16, 21 September 2010 by >Sncplay42 (Did anyone else know this?)
Jump to navigationJump to search

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 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.