Skip to content

Instance

Supported Class Other NotBrowsable NotCreatable

Instance is the base class for all classes in the Roblox class hierarchy which can be part of the DataModel tree.

51 Nova members · 12 modern Roblox members not implemented yet

Description

Instance is the base class for all classes in the Roblox class hierarchy which can be part of the DataModel tree.

It is not possible to directly create root Instance objects, but the special Instance.new() constructor creates objects via code, taking the name of the class as a parameter and returning the created object.

Inheritance

Object → Instance

Known subclasses: AccessoryDescription, AccountService, Accoutrement, AchievementService, ActivityHistoryEventService, AdPlacement, AdPortal, AdService, and 617 more

Properties

Archivable Supported Property Determines if an Instance and its descendants can be cloned using Instance.Clone(), and can be saved/published.
Archivable: bool

Determines if an Instance and its descendants can be cloned using Instance.Clone(), and can be saved/published.

This property determines whether the instance should be included when the experience is published or saved, or when Clone() is called on one of the instance's ancestors. Calling Clone() directly on an instance will return nil if that instance is not Archivable.

Copying an object in Studio using the Duplicate or Copy/Paste options will ignore its own Archivable property and set Archivable to true for the copy.

Roblox documentation

archivable Supported Property Deprecated
archivable: bool

No description available.

Roblox documentation

ClassName Supported Property A read-only string representing the class this Object belongs to.
ClassName: string

A read-only string representing the class this Object belongs to.

This property can be used with various other functions that are used to identify objects by type, such as Object.IsA() or Instance.FindFirstChildOfClass().

Note this property is read only and cannot be altered by scripts. Developers wishing to change an object's class will instead have to create a new Object.

Unlike Object.IsA(), ClassName can be used to check if an object belongs to a specific class ignoring class inheritance. For example:

Roblox documentation

className Supported Property Deprecated
className: string

No description available.

Nova behaviour: Nova keeps this legacy member for compatibility. Roblox's modern deprecation wording may describe later Roblox behaviour; verify it against Nova before relying on the copied text.

Roblox documentation

DataCost Supported Property
DataCost: int

No description available.

Security: RobloxPlaceSecurity

Roblox documentation

Name Supported Property A non-unique identifier of the Instance.
Name: string

A non-unique identifier of the Instance. Names are used to keep the object hierarchy organized, along with allowing scripts to access specific objects. The name of an instance cannot exceed 100 characters in size.

The name of an object is often used to access the object through the data model hierarchy using the following methods:

local Workspace = game:GetService("Workspace")

local baseplate = Workspace.Baseplate
local baseplate = Workspace["Baseplate"]
local baseplate = Workspace:FindFirstChild("BasePlate")

In order to make an object accessible using the dot operator (.), its name must start with an underscore or letter, and the rest of the name can only contain letters, numbers, or underscores (no other special characters). If an object's name does not follow this syntax, it will not be accessible using the dot operator and Luau will not interpret its name as an identifier.

If more than one object with the same name are siblings, any attempt to index an object by that name will return only one of the objects, similar to Instance.FindFirstChild(), but not always the desired object. If a specific object needs to be accessed through code, it's recommended to give it a unique name or guarantee that none of its siblings share the same name.

See also Instance.GetFullName() to obtain a full name including the object's hierarchy.

Roblox documentation

Parent Supported Property Determines the hierarchical parent of the Instance.
Parent: Object

The Parent property determines the hierarchical parent of the Instance. The following terminology is commonly used when talking about how this property is set:

  • An object is a child of, or is parented to, another object when its Parent is set to that object.

  • The descendants of an Instance are the children of that object, plus the descendants of the children as well.

  • The ancestors of an Instance are all the objects that the instance is a descendant of.

It is from the Parent property that many other API members get their name, such as GetChildren() and FindFirstChild(). This property is also used to manage whether an object exists in the experience or needs to be removed. As long as an object's parent is in the DataModel, is stored in a variable, or is referenced by another object's property, the object remains in the experience; otherwise, the object will automatically be removed.

Calling Destroy() will set the Parent of an Instance and all of its descendants to nil, and also lock the Parent property. An error is raised when setting the Parent of a destroyed object.

Newly created objects using Instance.new() will not have a parent, and usually will not be visible or function until one is set.

Object Replication

An object created by the server will not replicate to clients until it is parented to some object that is replicated. When creating an object and setting many properties, it's recommended to set the Parent property last. This ensures the object replicates once, instead of replicating many property changes.

local Workspace = game:GetService("Workspace")

-- Set new instance's parent last (recommended)
local part = Instance.new("Part")
part.Position = Vector3.new(0, 10, 0)
part.Parent = Workspace

However, if parenting parts to a Model whose parent hasn't been set yet, parenting each part to that model is acceptable since the model would not have replicated.

Roblox reference signature
Parent: Instance

Roblox documentation

RobloxLocked Supported Property Deprecated A deprecated property that used to protect CoreGui objects.
RobloxLocked: bool

A deprecated property that used to protect CoreGui objects.

This property used to protect objects in the CoreGui service from being altered by users in an unauthorized manner. It has been deprecated and does not do anything.

Security: PluginSecurity

Roblox documentation

Methods

AddTag Supported Function Applies a tag to the instance.
Instance:AddTag(string tag): bool

Applies a tag to the instance.

This method applies a tag to the instance, with no effect if the tag is already applied. Successfully adding a tag will fire a signal created by CollectionService.GetInstanceAddedSignal() with the given tag.

Warnings

  • An instance's tags that were added client-side will be dropped if the server later adds or removes a tag on that instance because the server replicates all tags together and overwrites previous tags.

  • When tagging an instance, it is common that some resources are used to give the tag its functionality, for example event connections or tables. To prevent memory leaks, it's a good idea to clean these up (disconnect, set to nil, etc.) when no longer needed for a tag. Do this when calling Instance.RemoveTag(), calling Instance.Destroy(), or in a function connected to a signal returned by CollectionService.GetInstanceRemovedSignal().

Roblox reference signature
Instance:AddTag(tag: string): null

Roblox documentation

children Supported Function Deprecated Returns an array of the object's children.
Instance:children(): Objects

The children function returns an array of the object's children.

Roblox reference signature
Instance:children(): Instances
Nova behaviour: Nova keeps this legacy member for compatibility. Roblox's modern deprecation wording may describe later Roblox behaviour; verify it against Nova before relying on the copied text.

Roblox documentation

ClearAllChildren Supported Function This method destroys all of an instance's children.
Instance:ClearAllChildren()

This method destroys all of an instance's children.

This method destroys all of an instance's children and descendants.

local part = Instance.new("Part")

-- Add some sparkles
for i = 1, 3 do
    local sparkles = Instance.new("Sparkles")
    sparkles.Parent = part

  local sc = Instance.new("Sparkles")
  sc.Parent = sparkles
end

print("Children:", #part:GetChildren())  --> Children: 3

part:ClearAllChildren()

print("Children:", #part:GetChildren())  --> Children: 0

If you do not wish to destroy all children and descendants, use either Instance.GetChildren() or Instance.GetDescendants() to loop through those children/descendants and select what to destroy. For example, the following code sample will destroy all BaseParts descending from a Model:

local Workspace = game:GetService("Workspace")

local model = Workspace:FindFirstChild("TestModel")

for _, descendant in model:GetDescendants() do
    if descendant:IsA("BasePart") then
        descendant:Destroy()
    end
end
Roblox reference signature
Instance:ClearAllChildren(): null

Roblox documentation

Clone Supported Function Create a copy of an instance and all its descendants, ignoring instances that are not Archivable.
Instance:Clone(): Instance

Create a copy of an instance and all its descendants, ignoring instances that are not Archivable.

Clone() creates a copy of an instance and all of its descendants, ignoring all instances that are not Archivable. The copy of the root instance is returned by this method and its Parent is set to nil. Note that if the instance itself has Archivable set to false, this method will return nil.

If a reference property such as ObjectValue.Value is set in a cloned instance, the value of the copy's property depends on the original's value:

  • If a reference property refers to an instance that was also cloned, the copy will refer to the copy.
  • If a reference property refers to an instance that was not cloned, the same value is maintained in the copy.

Roblox documentation

clone Supported Function Deprecated Use Clone() instead
Instance:clone(): Instance

Use Clone() instead

Nova behaviour: Nova keeps this legacy member for compatibility. Roblox's modern deprecation wording may describe later Roblox behaviour; verify it against Nova before relying on the copied text.

Roblox documentation

Destroy Supported Function Sets the Instance.Parent property to nil, locks the Instance.Parent property, disconnects all connections, and calls Destroy() on all children.
Instance:Destroy()

Sets the Instance.Parent property to nil, locks the Instance.Parent property, disconnects all connections, and calls Destroy() on all children. This method is the correct way to dispose of objects that are no longer required.

Disposing of unneeded objects is important, since unnecessary objects and connections in a place use up memory which can lead to serious performance issues over time.

As a best practice after calling Destroy() on an object, set any variables referencing the object (or its descendants) to nil. This prevents your code from accessing anything to do with the object.

local part = Instance.new("Part")
part.Name = "Hello, world"
part:Destroy()
-- Don't do this:
print(part.Name)  --> "Hello, world"
-- Do this to prevent the above line from working:
part = nil

Once an Instance has been destroyed by this method, it cannot be reused because the Instance.Parent property is locked. To temporarily remove an object instead of destroying it, set Parent to nil. For example:

local Workspace = game:GetService("Workspace")

object.Parent = nil
task.wait(2)
object.Parent = Workspace

To destroy an object after a set amount of time, use Debris.AddItem().

Roblox reference signature
Instance:Destroy(): null

Roblox documentation

destroy Supported Function Deprecated
Instance:destroy()

No description available.

Roblox reference signature
Instance:destroy(): null
Nova behaviour: Nova keeps this legacy member for compatibility. Roblox's modern deprecation wording may describe later Roblox behaviour; verify it against Nova before relying on the copied text.

Roblox documentation

FindFirstAncestor Supported Function Returns the first ancestor of the Instance whose Instance.Name is equal to the given name.
Instance:FindFirstAncestor(string name): Instance

Returns the first ancestor of the Instance whose Instance.Name is equal to the given name.

This method works upwards, meaning it starts at the instance's immediate Instance.Parent and works up towards the DataModel. If no matching ancestor is found, it returns nil.

The following code snippet would find the first ancestor of the object named Car.

local car = object:FindFirstAncestor("Car")

For variants of this method that find ancestors of a specific class, please see Instance.FindFirstAncestorOfClass() and Instance.FindFirstAncestorWhichIsA().

Roblox reference signature
Instance:FindFirstAncestor(name: string): Instance

Roblox documentation

FindFirstAncestorOfClass Supported Function Returns the first ancestor of the Instance whose Object.ClassName is equal to the given className.
Instance:FindFirstAncestorOfClass(string className): Instance

Returns the first ancestor of the Instance whose Object.ClassName is equal to the given className.

This method works upwards, meaning it starts at the instance's immediate Instance.Parent and works up towards the DataModel. If no matching ancestor is found, it returns nil.

A common use of this method is finding the Model a BasePart belongs to. For example:

local model = part:FindFirstAncestorOfClass("Model")

This method is a variant of Instance.FindFirstAncestor() which checks the Object.ClassName property rather than Instance.Name. Instance.FindFirstAncestorWhichIsA() also exists, using the Object.IsA() method instead to respect class inheritance.

Roblox reference signature
Instance:FindFirstAncestorOfClass(className: string): Instance

Roblox documentation

FindFirstAncestorWhichIsA Supported Function Returns the first ancestor of the Instance for whom Object.IsA() returns true for the given className.
Instance:FindFirstAncestorWhichIsA(string className): Instance

Returns the first ancestor of the Instance for whom Object.IsA() returns true for the given className.

This method works upwards, meaning it starts at the instance's immediate Instance.Parent and works up towards the DataModel. If no matching ancestor is found, it returns nil.

Unlike Instance.FindFirstAncestorOfClass(), this method uses Object.IsA() which respects class inheritance. For example:

print(part:IsA("Part"))  --> true
print(part:IsA("BasePart"))  --> true
print(part:IsA("Instance"))  --> true

Therefore, the following code sample will return the first BasePart ancestor, regardless of if it is a WedgePart, MeshPart or Part.

local part = object:FindFirstAncestorWhichIsA("BasePart")

See also Instance.FindFirstAncestor().

Roblox reference signature
Instance:FindFirstAncestorWhichIsA(className: string): Instance

Roblox documentation

FindFirstChild Supported Function Returns the first child of the Instance found with the given name.
Instance:FindFirstChild(string name, bool recursive = false): Instance

Returns the first child of the Instance found with the given name.

Returns the first child of the Instance with the given name, or nil if no such child exists. If the optional recursive argument is true, this method searches all descendants rather than only the immediate children of the Instance.

Checking the Existence of an Object

FindFirstChild() is necessary if you need to verify an object exists before continuing. Attempting to index a child by name using the dot operator throws an error if the child doesn't exist.

local Workspace = game:GetService("Workspace")

-- The following line errors if the part doesn't exist in the workspace
Workspace.Part.Transparency = 0.5

A better approach is to use FindFirstChild() to first check for Part, then use an if statement to run code that needs it.

local Workspace = game:GetService("Workspace")

local part = Workspace:FindFirstChild("Part")
if part then
    part.Transparency = 0.5
end

Finding a Child Whose Name Matches a Property

Sometimes the Name of an object is the same as that of a property of its Parent. When using the dot operator, properties take precedence over children if they share a name.

In the following example, a Folder called Color is added to a Part, which also has the Part.Color property. Notice that part.Color refers to the Color3 property value, not the child Folder instance. A benefit of using FindFirstChild() is that the introduction of new properties does not impose a risk on your code.

local part = Instance.new("Part")
local folder = Instance.new("Folder")
folder.Name = "Color"
folder.Parent = part
local c1 = part.Color  -- The property
local c2 = part:FindFirstChild("Color")  -- The child folder

Performance Notes

FindFirstChild() takes about 20% longer than using the dot operator and almost 8 times longer than simply storing a reference to an object. Therefore, you should avoid calling it in performance-dependent code such as in tight loops or functions connected to RunService.Heartbeat and RunService.PreRender. Instead, store the result in a variable, or consider using ChildAdded or WaitForChild() to detect when a child of a given name becomes available.

Roblox reference signature
Instance:FindFirstChild(name: string, recursive: bool = false): Instance

Roblox documentation

findFirstChild Supported Function Deprecated Use FindFirstChild() instead
Instance:findFirstChild(string name, bool recursive = false): Instance

Use FindFirstChild() instead

Roblox reference signature
Instance:findFirstChild(name: string, recursive: bool = false): Instance
Nova behaviour: Nova keeps this legacy member for compatibility. Roblox's modern deprecation wording may describe later Roblox behaviour; verify it against Nova before relying on the copied text.

Roblox documentation

FindFirstChildOfClass Supported Function Returns the first child of the Instance whose ClassName is equal to the given class name.
Instance:FindFirstChildOfClass(string className): Instance

Returns the first child of the Instance whose ClassName is equal to the given className. Unlike Instance.FindFirstChildWhichIsA(), this method only returns objects whose class matches className, ignoring class inheritance. If no matching child is found, this method returns nil.

Roblox reference signature
Instance:FindFirstChildOfClass(className: string): Instance

Roblox documentation

FindFirstChildWhichIsA Supported Function Returns the first child of the Instance for whom Object.IsA() returns true for the given className.
Instance:FindFirstChildWhichIsA(string className): Instance

Returns the first child of the Instance for whom Object.IsA() returns true for the given className.

If no matching child is found, this method returns nil. If the optional recursive argument is true, this method searches all descendants rather than only the immediate children of the Instance.

Unlike Instance.FindFirstChildOfClass(), this method uses Object.IsA() which respects class inheritance. For example:

print(part:IsA("Part")) --> true
print(part:IsA("BasePart")) --> true
print(part:IsA("Instance")) --> true

Therefore, the following code sample will return the first BasePart child, regardless of if it is a WedgePart, MeshPart or Part.

local part = object:FindFirstChildWhichIsA("BasePart")

Developers looking for a child by name, should use Instance.FindFirstChild() instead.

Roblox reference signature
Instance:FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance

Roblox documentation

FindFirstDescendant Supported Function Returns the first descendant found with the given Instance.Name.
Instance:FindFirstDescendant(string name): Instance

Returns the first descendant found with the given Instance.Name.

This method is disabled and cannot be used. To find the first descendant of an instance, consider using the recursive parameter on Instance.FindFirstChild() instead.

Roblox reference signature
Instance:FindFirstDescendant(name: string): Instance

Roblox documentation

GetAttribute Supported Function Returns the value which has been assigned to the given attribute name.
Instance:GetAttribute(string attribute): Variant

This method returns the value which has been assigned to the given attribute name. If no attribute has been assigned, nil is returned.

For example, the following code snippet sets and then gets the value of the instance's InitialPosition attribute:

local Workspace = game:GetService("Workspace")

local part = Workspace.Part
part:SetAttribute("InitialPosition", part.Position)

local initialPosition = instance:GetAttribute("InitialPosition")
print(initialPosition)

See Also

Roblox reference signature
Instance:GetAttribute(attribute: string): Variant

Roblox documentation

GetAttributeChangedSignal Supported Function Returns an event that fires when the given attribute changes.
Instance:GetAttributeChangedSignal()

Returns an event that fires when the given attribute changes.

This method returns an event that behaves exactly like the Changed event, except that it only fires when the specific given attribute changes; effectively it is similar to GetPropertyChangedSignal() but for attributes.

It's generally a good idea to use this method instead of a connection to Changed with a function that checks the attribute name. Subsequent calls to this method on the same object with the same attribute name return the same event.

The following code example returns a signal that fires the function attributeChanged() when the part's InitialPosition attribute changes:

local Workspace = game:GetService("Workspace")

local part = Workspace.Part
part:SetAttribute("InitialPosition", part.Position)

local function attributeChanged()
    print("Attribute changed")
end

part:GetAttributeChangedSignal("InitialPosition"):Connect(attributeChanged)

See also Instance.AttributeChanged which fires whenever any attribute is changed on the instance.

Roblox reference signature
Instance:GetAttributeChangedSignal(attribute: string): RBXScriptSignal

Roblox documentation

GetAttributes Supported Function Returns a dictionary of the instance's attributes.
Instance:GetAttributes(): Dictionary

Returns a dictionary of the instance's attributes.

This method returns a dictionary of key‑value pairs for each attribute where the key is the attribute's name and the value is a non‑nil value.

For example, the following code snippet outputs an instance's attributes and values:

local Workspace = game:GetService("Workspace")

local part = Workspace.Part
part:SetAttribute("InitialPosition", part.Position)
part:SetAttribute("CanUse", true)

for name, value in part:GetAttributes() do
    print(name .. " = " .. value)
end

See also Instance.GetAttribute() which returns the value that has been assigned to the given attribute name.

Roblox documentation

GetChildren Supported Function Returns an array containing all of the instance's children.
Instance:GetChildren(): Objects

Returns an array containing all of the instance's children.

Returns an array (a numerically indexed table) containing all of the instance's direct children, or every Instance whose Parent is equal to the object. The array can be iterated upon using either a numeric or generic for loop:

local Workspace = game:GetService("Workspace")

-- Numeric loop example
local children = Workspace:GetChildren()
for i = 1, #children do
    local child = children[i]
    print(child.Name .. " is child number " .. i)
end
local Workspace = game:GetService("Workspace")

-- Generic loop example
local children = Workspace:GetChildren()
for i, child in children do
    print(child.Name .. " is child number " .. i)
end

Note that the returned array is not sorted in any particular order, so manual sorting (for example using table.sort()) is advised for sorting the children returned by this method.

See also the GetDescendants() method.

Roblox reference signature
Instance:GetChildren(): Instances

Roblox documentation

getChildren Supported Function Deprecated Use GetChildren() instead
Instance:getChildren(): Objects

Use GetChildren() instead

Roblox reference signature
Instance:getChildren(): Instances
Nova behaviour: Nova keeps this legacy member for compatibility. Roblox's modern deprecation wording may describe later Roblox behaviour; verify it against Nova before relying on the copied text.

Roblox documentation

GetDebugId Supported Function Returns a coded string of the debug ID used internally by Roblox.
Instance:GetDebugId(int scopeLength = 4): string

Returns a coded string of the debug ID used internally by Roblox. Note that:

  • This item is protected. Attempting to use it in a Script or LocalScript will cause an error.
  • A debug ID is an ID used in debugging processes. It allows a debugger to read each instruction before an application processes it. All objects in Roblox act like processes and each run instructions (or 'code') that can be debugged if needed.
  • This can be helpful for plugins which need to distinguish similar objects from one-another (such as objects that share the same name).
Roblox reference signature
Instance:GetDebugId(scopeLength: int = 4): string
Security: PluginSecurity

Roblox documentation

GetDescendants Supported Function Returns an array containing all of the descendants of the instance.
Instance:GetDescendants(): Objects

Returns an array containing all of the descendants of the instance.

This object method returns an array that contains all of the descendants of that object. Unlike Instance.GetChildren(), which only returns the immediate children of an object, this method finds every child of the object, every child of those children, and so on.

Note that the returned array is not sorted in any particular order, so manual sorting (for example using table.sort()) is advised for sorting the descendants returned by this method. Also consdier the QueryDescendants() method to query descendants by a combination of selectors and combinators.

Roblox reference signature
Instance:GetDescendants(): Instances

Roblox documentation

GetFullName Supported Function Returns a string describing the instance's ancestry.
Instance:GetFullName(): string

Returns a string describing the instance's ancestry. The string is a concatenation of the Name of the object and its ancestors, separated by periods. The DataModel (game) is not considered. For example, a Part in the Workspace may return Workspace.Part.

When called on an Instance that is not a descendant of the DataModel, this method considers all ancestors up to and including the topmost one without a Parent.

This method is useful for logging and debugging. You shouldn't attempt to parse the returned string for any useful operation; this method does not escape periods (or any other symbol) in object names. In other words, although its output often appears to be a valid Luau identifier, it is not guaranteed.

Roblox documentation

GetPropertyChangedSignal Supported Function Get an event that fires when a given property of the object changes.
Instance:GetPropertyChangedSignal()

Get an event that fires when a given property of the object changes.

This method returns an event that behaves exactly like the Changed event, except that it only fires when the given property changes. It's generally a good idea to use this method instead of a connection to Changed with a function that checks the property name. Subsequent calls to this method on the same object with the same property name return the same event.

ValueBase objects, such as IntValue and StringValue, use a modified Changed event that fires with the contents of their Value property. As such, this method provides a way to detect changes in other properties of those objects.

Note that this event will not pass any arguments to a connected function, so the value of the changed property must be read directly within a script.

Limitations

The event returned by this method does not fire for physics-related changes, such as when the CFrame, AssemblyLinearVelocity, AssemblyAngularVelocity, Position, or Orientation properties of a BasePart change due to gravity. To detect changes in these properties, consider using a physics-based event like RunService.PreSimulation.

Additionally, the returned event may not fire on every modification of properties that change very frequently, and/or it may not fire for such properties at all. It's recommended that you carefully test for property changes that impact game logic.

Roblox reference signature
Object:GetPropertyChangedSignal(property: string): RBXScriptSignal

Roblox documentation

GetTags Supported Function Gets an array of all tags applied to the instance.
Instance:GetTags(): Array

Gets an array of all tags applied to the instance.

This method returns an array of the tags applied to the given instance, as strings. You can add tags either in Studio in the Properties window or at runtime with AddTag().

This method is useful when you want to do something with multiple tags on an instance at once. However, it is inefficient to use this method to check for the existence of a single tag; instead, use HasTag() to check for a specific tag.

Roblox documentation

HasTag Supported Function Check whether the instance has a given tag.
Instance:HasTag(string tag): bool

Check whether the instance has a given tag.

This method returns true if the provided tag has been added to the object. You can add tags either in Studio in the Properties window or at runtime with AddTag().

Roblox reference signature
Instance:HasTag(tag: string): bool

Roblox documentation

IsA Supported Function Returns true if an object's class matches or inherits from a given class.
Instance:IsA(string className): bool

Returns true if an object's class matches or inherits from a given class.

IsA returns true if the object's class is equivalent to or a subclass of a given class. This function is similar to the instanceof operators in other languages, and is a form of type introspection. To ignore class inheritance, test the ClassName property directly instead. For checking native Luau data types (number, string, etc) use the functions type and typeof.

Most commonly, this function is used to test if an object is some kind of part, such as Part or WedgePart, which inherits from BasePart (an abstract class). For example, if your goal is to change all of a character's limbs to the same color, you might use GetChildren to iterate over the children, then use IsA to filter non-BasePart objects which lack the BrickColor property:

local Players = game:GetService("Players")

local function paintFigure(character, color)
    -- Iterate over the child objects of the character
    for _, child in character:GetChildren() do
        -- Filter out non-part objects, such as Shirt, Pants and Humanoid
        -- R15 use MeshPart and R6 use Part, so we use BasePart here to detect both:
        if child:IsA("BasePart") then
            child.BrickColor = color
        end
    end
end
paintFigure(Players.Player.Character, BrickColor.new("Bright blue"))

Since all classes inherit from Object, calling object:IsA("Object") will always return true.

Roblox reference signature
Object:IsA(className: string): bool

Roblox documentation

isA Supported Function Deprecated Use IsA() instead
Instance:isA(string className): bool

Use IsA() instead

Roblox reference signature
Object:isA(className: string): bool
Nova behaviour: Nova keeps this legacy member for compatibility. Roblox's modern deprecation wording may describe later Roblox behaviour; verify it against Nova before relying on the copied text.

Roblox documentation

IsAncestorOf Supported Function Returns true if an Instance is an ancestor of the given descendant.
Instance:IsAncestorOf(Instance descendant): bool

Returns true if an Instance is an ancestor of the given descendant.

An Instance is considered the ancestor of an object if the object's Instance.Parent or one of it's parent's Instance.Parent is set to the Instance.

See also, Instance.IsDescendantOf().

Roblox reference signature
Instance:IsAncestorOf(descendant: Instance): bool

Roblox documentation

IsDescendantOf Supported Function Returns true if an Instance is a descendant of the given ancestor.
Instance:IsDescendantOf(Instance ancestor): bool

Returns true if an Instance is a descendant of the given ancestor.

Note that IsDescendantOf() cannot be used with a parameter of nil to check if an object has been removed.

See also Instance.IsAncestorOf().

Roblox reference signature
Instance:IsDescendantOf(ancestor: Instance): bool

Roblox documentation

isDescendantOf Supported Function Deprecated
Instance:isDescendantOf(Instance ancestor): bool

No description available.

Roblox reference signature
Instance:isDescendantOf(ancestor: Instance): bool
Nova behaviour: Nova keeps this legacy member for compatibility. Roblox's modern deprecation wording may describe later Roblox behaviour; verify it against Nova before relying on the copied text.

Roblox documentation

Remove Supported Function Deprecated Nova: still functional Legacy removal method. Sets the instance's Parent to nil.
Instance:Remove()

Legacy removal method. Sets the instance's Parent to nil.

Nova still implements this as the legacy removal call. It sets Parent to nil for the instance and its descendants. Prefer Destroy() in new code.

Roblox reference signature
Instance:Remove(): null
Nova behaviour: Still works; prefer Destroy().

Roblox documentation

remove Supported Function Deprecated Use Remove() instead
Instance:remove()

Use Remove() instead

Roblox reference signature
Instance:remove(): null
Nova behaviour: Nova keeps this legacy member for compatibility. Roblox's modern deprecation wording may describe later Roblox behaviour; verify it against Nova before relying on the copied text.

Roblox documentation

RemoveTag Supported Function Removes a tag from the instance.
Instance:RemoveTag(string tag): bool

Removes a tag from the instance.

This method removes a tag from an instance. It will not throw an error if the object does not have the tag. Successfully removing a tag will fire a signal created by CollectionService.GetInstanceRemovedSignal() with the given tag.

Note that when tagging an instance, it's common that some resources are used to give the tag its functionality, for example event connections or tables. To prevent memory leaks, it's a good idea to clean these up (disconnect, set to nil, etc.) when no longer needed for a tag.

Roblox reference signature
Instance:RemoveTag(tag: string): null

Roblox documentation

SetAttribute Supported Function Sets the attribute with the given name to the given value.
Instance:SetAttribute(string attribute, Variant value)

This method sets the attribute with the given name to the given value. If the value given is nil, the attribute will be removed, since nil is returned by default.

For example, the following code snippet sets the instance's InitialPosition attribute to Datatype.Vector3|Vector3.new(0, 10, 0):

local Workspace = game:GetService("Workspace")

local part = Workspace.Part
part:SetAttribute("InitialPosition", Vector3.new(0, 10, 0))

Limitations

Naming requirements and restrictions:

  • Names must only use alphanumeric characters.
  • You may also include periods, hyphens, slashes, and underscores.
  • No spaces or unique symbols (such as @, ~, !) are allowed.
  • Strings must be 100 characters or less.
  • Names are not allowed to start with RBX unless the caller is a Roblox core script (reserved for Roblox).

When attempting to set an attribute to an unsupported type, an error will be thrown.

See Also

Roblox reference signature
Instance:SetAttribute(attribute: string, value: Variant): null

Roblox documentation

WaitForChild Supported Function Returns the child of the Instance with the given name. If the child does not exist, it will yield the current thread until it does.
Instance:WaitForChild(string childName): Instance

Returns the child of the Instance with the given name. If the child does not exist, it will yield the current thread until it does. If the timeOut parameter is specified, this method will time out after the specified number of seconds and return nil.

Primary Usage

WaitForChild() is extremely important when working on code run by the client in a LocalScript. The Roblox engine does not guarantee the time or order in which objects are replicated from the server to the client. Additionally, if an experience has Workspace.StreamingEnabled set to true, BaseParts that are far away from the player's character may not be streamed to the client, potentially causing scripts to break when indexing objects that do not yet exist on the client.

Notes

  • This method does not yield if a child with the given name exists when the call is made.
  • Instance.FindFirstChild() is a more efficient alternative to WaitForChild() for objects that are assumed to exist.
  • If a call to this method exceeds 5 seconds without returning, and no timeOut parameter has been specified, a warning will be printed to the output that the thread may yield indefinitely.
Roblox reference signature
Instance:WaitForChild(childName: string, timeOut: double): Instance

Roblox documentation

Events

AncestryChanged Supported Event Fires when the Instance.Parent property of this object or one of its ancestors is changed.
AncestryChanged(Instance child, Instance parent)

Fires when the Instance.Parent property of this object or one of its ancestors is changed.

Fires when this instance is reparented or when any of its ancestors is reparented.

You can use this event to track the deletion of an instance in Studio, such as manual deletion in the Explorer or through a plugin. If you need to detect when an instance is destroyed using Instance.Destroy(), use the Instance.Destroying event instead.

Roblox reference signature
AncestryChanged(child: Instance, parent: Instance)

Roblox documentation

Changed Supported Event Fires immediately after a property of the object changes, with some limitations.
Changed(Property property)

Fires immediately after a property of the object changes, with some limitations.

This event fires immediately after an object property is changed, with some exceptions (see below). The new value of a changed property is not passed as a parameter. Instead, you can access it using object[property]:

object.Changed:Connect(function(property)
    print("The new property's value is", object[property])
end)

For ValueBase objects such as IntValue and StringValue, this event only fires when the object's Value property changes. To detect other changes in ValueBase objects, use GetPropertyChangedSignal().

Limitations

This event does not fire for physics-related changes, such as when the CFrame, AssemblyLinearVelocity, AssemblyAngularVelocity, Position, or Orientation properties of a BasePart change due to gravity. To detect changes in these properties, consider using a physics-based event like RunService.PreSimulation. Similarly, the Changed event does not fire when AssemblyMass updates due to a change in material, size, or density for a welded part (but the event does fire for Mass if you modify a part's size).

For properties that change frequently, the Changed event might not fire for every modification, or it might not fire at all. If a property change impacts your game logic, test carefully to ensure the event is firing as you expect.

Roblox reference signature
Changed(property: string)

Roblox documentation

ChildAdded Supported Event Fires after an object is parented to this Instance.
ChildAdded(Instance child)

Fires after an object is parented to this Instance.

Note, when using this method on a client to detect objects created by the server it is necessary to use Instance.WaitForChild() when indexing these object's descendants. This is because the object and its descendants are not guaranteed to replicate from the server to the client simultaneously. For example:

local Workspace = game:GetService("Workspace")

Workspace.ChildAdded:Connect(function(child)
    -- Use WaitForChild() since descendants may not have replicated yet
    local head = child:WaitForChild("Head")
end)

Note, this event only operates for immediate children of the Instance. For an event that captures all descendants, use Instance.DescendantAdded.

See also Instance.ChildRemoved.

Roblox reference signature
ChildAdded(child: Instance)

Roblox documentation

childAdded Supported Event Deprecated
childAdded(Instance child)

No description available.

Roblox reference signature
childAdded(child: Instance)
Nova behaviour: Nova keeps this legacy member for compatibility. Roblox's modern deprecation wording may describe later Roblox behaviour; verify it against Nova before relying on the copied text.

Roblox documentation

ChildRemoved Supported Event Fires after a child is removed from this Instance.
ChildRemoved(Instance child)

Fires after a child is removed from this Instance.

Removed refers to when an object's parent is changed from this Instance to something other than this Instance. Note, this event will also fire when a child is destroyed (using Instance.Destroy()) as the destroy function sets an object's parent to nil.

This event only operates for immediate children of the Instance. For an event that captures all descendants, use Instance.DescendantRemoving.

See also Instance.ChildAdded.

Roblox reference signature
ChildRemoved(child: Instance)

Roblox documentation

DescendantAdded Supported Event Fires after a descendant is added to the Instance.
DescendantAdded(Instance descendant)

This event fires after a descendant is added to the Instance.

As it fires for every descendant, parenting an object to the Instance will fire the event for this object and all of its descendants individually.

If you're only concerned with the direct children of the Instance, use Instance.ChildAdded instead.

See also Instance.DescendantRemoving.

Roblox reference signature
DescendantAdded(descendant: Instance)

Roblox documentation

DescendantRemoving Supported Event Fires immediately before a descendant of the Instance is removed.
DescendantRemoving(Instance descendant)

Fires immediately before a descendant of the Instance is removed.

This event fires immediately before the parent Instance changes such that a descendant instance will no longer be a descendant. Destroy() changes an instance's Parent to nil, so calling that method on a descendant of the parent will cause this event to fire.

Since this event fires before the descendant's removal, the parent of the descendant will be unchanged at the time of this event firing. If the descendant is also a direct child of the parent, this event will fire before Instance.ChildRemoved.

If a descendant has children, this event fires with the descendant first, followed by its descendants.

Warning

This event fires with the descendant object that is being removed. Attempting to set the Parent of the descendant to something else will fail. Below is an example that demonstrates this:

local Workspace = game:GetService("Workspace")

Workspace.DescendantRemoving:Connect(function(descendant)
    -- Do not manipulate the parent of the descendant in this function!
    -- This event fires BECAUSE the parent was manipulated, and the change hasn't happened yet
    -- Therefore, it is problematic to change the parent like this:
    descendant.Parent = game
end)

local part = Instance.new("Part")
part.Parent = Workspace
part.Parent = nil

See also DescendantAdded.

Roblox reference signature
DescendantRemoving(descendant: Instance)

Roblox documentation

12 modern Roblox member(s) are not implemented yet — expand to inspect

Members declared by Roblox's Instance class (or by a missing base class) that Nova does not expose. Use this list to scope a migration; the compatibility guide has the recommended workaround.

Properties

Member Signature Status Notes Flags
Capabilities Capabilities: SecurityCapabilities Not yet The set of capabilities allowed to be used for scripts inside this container. —
Sandboxed Sandboxed: bool Not yet When enabled, the instance can only access abilities in its Capabilities list. NotReplicated
UniqueId UniqueId: UniqueId Not yet A unique identifier for the instance. NotReplicated, read RobloxScriptSecurity / write RobloxSecu…

Methods

Member Signature Status Notes Flags
GetActor Instance:GetActor(): Actor Not yet Returns the Actor associated with the Instance, if any. —
GetStyled Instance:GetStyled(name: string, selector: string?): Variant Not yet Returns the styled or explicitly modified value of the specified property, or else the default property value if it hasn't been styled/modified. —
GetStyledPropertyChangedSignal Instance:GetStyledPropertyChangedSignal(property: string): RBXScriptSignal Not yet Returns an event that fires when the given style property changes on the instance. —
IsPropertyModified Instance:IsPropertyModified(property: string): bool Not yet Returns true if the value stored in the specified property is not equal to the code-instantiated default. —
QueryDescendants Instance:QueryDescendants(selector: string): Instances Not yet Returns an array containing all descendants of the instance that match the selector string. CustomLuaState
ResetPropertyToDefault Instance:ResetPropertyToDefault(property: string): null Not yet Resets a property to its default value. —

Events

Member Signature Status Notes Flags
AttributeChanged AttributeChanged(attribute: string) Not yet Fires whenever an attribute is changed on the Instance. —
Destroying Destroying() Not yet Fires immediately before (or is deferred until after) the instance is destroyed via Instance.Destroy(). —
StyledPropertiesChanged StyledPropertiesChanged() Not yet Fires whenever any style property is changed on the instance, including when a property is set to nil. —

Roblox reference: Instance

Generated from Nova's API dump and Roblox creator-docs. Nova-only members come from the engine's reflection metadata.