Instance (Data Structure)
In Roblox, an Instance is an object in a Roblox game. Roblox's namespace has a data-type 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.
Returns a new object of the class named by className, if it can be created.
Returns a new object of the class named by className, and sets it's Parent property to parent.
- Due to how Roblox handles property listeners, setting properties after parenting an object can cause performance issues. It would be in your best interest to avoid using this method. For more information, see this thread
Creating new objects is simpler than one would guess. You can find a list of object types (called classes) in the Class Reference. To create a new Instance, you use the Instance.new() function and pass one argument - a string that refers to what class you wish to make.
Optionally, you can pass a second argument, referring to what Instance the new instance should be parented to, but this is not recommended.
By default, objects created with Instance.new() retain their default properties (such as new bricks being 2 by 4 studs large). Because of this, the Parent property of created objects is nil and must be set for the object to be functional in the game.