Instance (Data Structure)

< Global namespace | Roblox namespace

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


Instance className)

Returns a new object of the class named by className, if it can be created.

Instance className, Instance parent)

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 Instances

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 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 Object Icon.pngInstance the new instance should be parented to, but this is not recommended.

local part ="Part")
part.Anchored = true
part.BrickColor ="Really red")
part.Name = "Red Part"
part.Parent = workspace
local hint ="Hint")
hint.Text = "The name of the part we created is: " .. part.Name
hint.Parent = workspace

By default, objects created with 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.