Remember and learn this "Documentation
Search Documentation
Engine API
Classes
DataStore
DataStore
Show Deprecated
NOT CREATABLE
NOT REPLICATED
See Data Stores.

Summary
Properties
Methods
GetVersionAsync(key: string, version: string): Tuple  YIELDS
Retrieves the specified key version.

ListKeysAsync(prefix: string, pageSize: number, cursor: string, excludeDeleted: boolean): DataStoreKeyPages  YIELDS
Returns a DataStoreKeyPages object for enumerating through keys of a data store.

ListVersionsAsync(key: string, sortDirection: SortDirection, minDate: number, maxDate: number, pageSize: number): DataStoreVersionPages  YIELDS
Enumerates all versions of a key.

RemoveVersionAsync(key: string, version: string): void  YIELDS
Permanently deletes the specified version of a key.

OnUpdate(key: string, callback: function): RBXScriptConnection  DEPRECATED
Sets callback as a function to be executed any time the value associated with key is changed.

GetAsync(key: string): Tuple  YIELDS
Returns the value of a key in a specified data store and a DataStoreKeyInfo instance.

IncrementAsync(key: string, delta: number, userIds: Array, options: DataStoreIncrementOptions): Variant  YIELDS
Increments the value of a key by the provided amount (both must be integers).

RemoveAsync(key: string): Tuple  YIELDS
Removes the specified key while also retaining an accessible version.

SetAsync(key: string, value: Variant, userIds: Array, options: DataStoreSetOptions): Variant  YIELDS
Sets the value of the data store for the given key.

UpdateAsync(key: string, transformFunction: function): Tuple  YIELDS
Updates a key's value with a new value from the specified callback function.

ClearAllChildren(): void  
This function destroys all of an Instance's children.

Clone(): Instance  
Create a copy of an object and all its descendants, ignoring objects that are not Archivable.

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

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

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

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

FindFirstChild(name: string, recursive: boolean): Instance  
Returns the first child of the Instance found with the given name.

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

FindFirstChildWhichIsA(className: string, recursive: boolean): Instance  
Returns the first child of the Instance for whom Instance:IsA() returns true for the given className.

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

GetActor(): Actor  
Returns the Actor associated with the Instance, if any.

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

GetAttributeChangedSignal(attribute: string): RBXScriptSignal  
Returns an event that fires when the given attribute changes.

GetAttributes(): table  
Returns a dictionary of string → variant pairs for each of the Instance's attributes.

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

GetDebugId(scopeLength: number): string  NOT BROWSABLE
Returns a coded string of the Instances DebugId used internally by Roblox.

GetDescendants(): Array  CUSTOM LUA STATE
Returns an array containing all of the descendants of the instance.

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

GetPropertyChangedSignal(property: string): RBXScriptSignal  
Get an event that fires when a given property of an object changes.

IsA(className: string): boolean  CUSTOM LUA STATE
Returns true if an Instance's class matches or inherits from a given class.

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

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

Remove(): void  DEPRECATED
Sets the object's Parent to nil, and does the same for all its descendants.

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

WaitForChild(childName: string, timeOut: number): Instance  CUSTOM LUA STATE, CAN YIELD
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.

children(): Objects  DEPRECATED
Returns an array of the object's children.

clone(): Instance  DEPRECATED

destroy(): void  DEPRECATED

findFirstChild(name: string, recursive: boolean): Instance  DEPRECATED

getChildren(): Objects  DEPRECATED

isA(className: string): boolean  DEPRECATED, CUSTOM LUA STATE

isDescendantOf(ancestor: Instance): boolean  DEPRECATED

remove(): void  DEPRECATED

Events
AncestryChanged(child: Instance, parent: Instance): RBXScriptSignal  
Fires when the Instance.Parent property of the object or one of its ancestors is changed.

AttributeChanged(attribute: string): RBXScriptSignal  
Fires whenever an attribute is changed on the Instance.

Changed(property: string): RBXScriptSignal  
Fired immediately after a property of an object changes.

ChildAdded(child: Instance): RBXScriptSignal  
Fires after an object is parented to this Instance.

ChildRemoved(child: Instance): RBXScriptSignal  
Fires after a child is removed from this Instance.

DescendantAdded(descendant: Instance): RBXScriptSignal  
Fires after a descendant is added to the Instance.

DescendantRemoving(descendant: Instance): RBXScriptSignal  
Fires immediately before a descendant of the Instance is removed.

Destroying(): RBXScriptSignal  
Fires immediately before the instance is destroyed via Instance:Destroy().

childAdded(child: Instance): RBXScriptSignal  DEPRECATED

Properties
Archivable
boolean
READ PARALLEL
This property determines whether an object should be included when the game is published or saved, or when Instance:Clone() is called on one of the object's ancestors. Calling Clone directly on an object will return nil if the cloned object is not archivable. Copying an object in Studio (using the 'Duplicate' or 'Copy' options) will ignore the Archivable property and set Archivable to true for the copy.

local part = Instance.new("Part")
print(part:Clone())  --> Part
part.Archivable = false
print(part:Clone())  --> nil
ClassName
string
READ ONLY
NOT REPLICATED
READ PARALLEL
A read-only string representing the class this Instance belongs to.

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

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

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

for _, child in ipairs(game.Workspace:GetChildren()) do
    if child.ClassName == "Part" then
        print("Found a Part")
        -- will find Parts in model, but NOT TrussParts, WedgeParts, etc
    end
end
Name
string
READ PARALLEL
A non-unique identifier of the Instance.

This property is an identifier that describes an object. Names are not necessarily unique identifiers however; multiple children of an object may share the same name. Names are used to keep the object hierarchy organized, along with allowing scripts to access specific objects.

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

local baseplate = workspace.Baseplate
local baseplate = workspace["Baseplate"]
local baseplate = workspace:FindFirstChild("BasePlate")
In order to make an object accessible using the dot operator, an object's Name must follow a certain syntax. The objects name must start with an underscore or letter. The rest of the name can only contain letters, numbers, or underscores (no other special characters). If an objects name does not follow this syntax it will not be accessible using the dot operator and Lua will not interpret its name as an identifier.

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

Note, a full name showing the instance's hierarchy can be obtained using Instance:GetFullName().

Parent
Instance
NOT REPLICATED
READ PARALLEL
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 (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 this property that many other API members get their name, such as GetChildren and FindFirstChild.

The Remove function sets this property to nil. 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.

This property is also used to manage whether an object exists in the game or needs removed. As long as an objects parent is in the DataModel, is stored in a variable, or is referenced by another objects property, then the object remains in the game. Otherwise, the object will automatically be removed. The top level DataModel object (the one referred to as the game by scripts) has no parent, but always has a reference held to it by the game engine, and exists for the duration of a session.

Newly created objects using Instance.new() will not have a parent, and usually will not be visible or function until one is set. The most elementary creation of an object has two steps: creating the object, then setting its parent.

-- Create a part and parent it to the workspace
local part = Instance.new("Part")
part.Parent = workspace
-- Instance new can also take Parent as a second parameter
Instance.new("NumberValue", workspace)
Object Replication
An object created by server will not replicate to clients until it is parented to some object that is replicated. When creating an object then setting many properties, it's recommended to set Parent last. This ensures the object replicates once, instead of replicating many property changes.

local part = Instance.new("Part") -- Avoid using the second parameter here
part.Anchored = true
part.BrickColor = BrickColor.new("Really red")
-- Potentially many other property changes could go here here...
-- Always set parent last!
part.Parent = workspace
However, if you were parenting your parts to a Model whose parent hasn't been set yet, then setting the parent first would not matter as the model would not have replicated yet.

RobloxLocked
boolean
HIDDEN
PLUGIN SECURITY
PLUGIN SECURITY
READ PARALLEL
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."