Skip to content

Instance

Inherits NetworkedObject

Instance is the base class of all classes. Every class derives from it and has all properties, events and functions Instance has.

Abstract Object

This object exists only to serve as a foundation for other objects. It cannot be accessed directly, but its properties are documented below.

Additionally, it cannot be created in the creator menu or with Instance.New().

Not newable

This object cannot be created by scripts using Instance.New().

Properties

Parent : Instance

Defines the parent of this instance in the hierarchy.

EditableChildren : boolean

Determine if children is editable, this is to be used if this instance is a Linked model. Only used in creator.

Tags : table

Tags associated with this instance.

Methods

GetDescendants → table

Parameters: ``

Gets all descendants of this instance.

FindChild → Instance

Parameters: name [ string ]

Finds a child of this instance by name.

WaitChild → Instance

Parameters

name [ string ]

timeoutSec [ number? ]

Wait for children to be added.

FindChildByClass → Instance

Parameters: className [ string ]

Finds a child of this instance by class name.

MoveChild → nil

Parameters

child [ Instance ]

index [ number ]

Move children to specified index

GetChildren → table

Parameters: ``

Gets all children of this instance.

GetChildrenOfClass → table

Parameters: className [ string ]

Gets all children of this instance that are of the specified class.

IsAncestorOf → boolean

Parameters: instance [ Instance ]

Determines if this instance is an ancestor of the given instance.

IsDescendantOf → boolean

Parameters: instance [ Instance ]

Determines if this instance is a descendant of the given instance.

IsDescendantOfClass → boolean

Parameters: className [ string ]

Determines if this instance is a descendant of the given class.

New → Instance

Parameters

className [ string ]

parent [ Instance? ]

Creates a new instance of the specified class.

AddTag → nil

Parameters: tag [ string ]

Adds a tag to this instance.

RemoveTag → nil

Parameters: tag [ string ]

Removes a tag from this instance.

HasTag → boolean

Parameters: tag [ string ]

Checks if this instance has the specified tag.

Reparent → nil

Parameters: to [ Instance ]

Reparent this instance to another instance

GetParent → Instance

Parameters: ``

Gets the parent of this instance.

SetParent → nil

Parameters: newParent [ Instance ]

Sets the parent of this instance.

Events

ChildAdded

Parameters: child [ Instance ]

Fires when child has been added to this instance

ChildRemoved

Parameters: child [ Instance ]

Fires when child has been removed from this instance (either via reparent or delete)

ChildDeleting

Parameters: child [ Instance ]

Fires when child is being deleted from this instance

ChildDeleted

Parameters: child [ Instance ]

Fires when child has been deleted from this instance