The Instanceclass is the base class of the object system. All other classes inherit, either directly or indirectly, from this class and Instance itself inherits from <<<ROOT>>>. The members that are common to all classes belong to the Instance class, which is why many of the most important and most used members belong to this class.
Determines whether or not an Instance can be saved when the game closes/attempts to save the game. Note: this only applies to games that use Data Persistence, or SavePlaceAsync.
Category: Behavior.
Serialization: cannot load or save.
Thread safety: read safe
stringClassName[ReadOnly][NotReplicated]
The string name of this Instance's most derived class.
If this property is true, only scripts with the Plugin permission will be able to index signals and children of the object, set its properties or assign its callbacks, call yielding functions of the object, change the parent of the object's children, or create objects with the object as the parent using Instance.new(class, parent). Furthermore, scripts that do not have this permission will not be able to call non-yielding functions of the object unless it is not a descendant of CoreGui.
This property is used, among other things, for GUI objects created by CoreScripts.
Returns a copy of this Object and all its children. The copy's Parent is nil.
Thread safety: unsafe
voidDestroy()
Removes object and all of its children from the object's parent, and parents them to nil, essentially deleting them. This method also prepares the garbage collector to collect it. Disconnects object and all children from open connections. Object and children may not be usable after calling Destroy.
Thread safety: unsafe
InstanceFindFirstAncestor(stringname)
Returns the first ancestor with the name of 'name', or nil if none is found.
Thread safety: safe
InstanceFindFirstAncestorOfClass(stringclassName)
Similar to FindFirstAncestor, but searches for an instance with the ClassName property equal to 'className' rather than the name property.
Returns the first child of this Instance that matches the first argument 'name'. The second argument 'recursive' is an optional boolean (defaults to false) that will force the call to traverse down thru all of this Instance's descendants until it finds an object with a name that matches the 'name' argument. The function will return nil if no Instance is found.
Thread safety: safe
InstanceFindFirstChildOfClass(stringclassName)
Attempts to return the first child of this Instance that has a ClassName of className, or nil if none are found.
Returns a EventInstance that fires when the given property for this Instance is changed.
Example:
localpart=Instance.new("Part")part.Parent=workspacelocalsignal=part:GetPropertyChangedSignal("Color")signal:Connect(function()print("New color!")end)part.Color=Color3.new(1,0,0)--> New color!
Thread safety: unsafe
boolIsA(stringclassName) [CustomLuaState]
Returns a boolean if this Instance is of type 'className' or a is a subclass of type 'className'. If 'className' is not a valid class type in ROBLOX, this function will always return false. More info.
Yields the script until the object is found. timeOut is an optional parameter. When timeOut seconds is reached, the function will drop out and return nil.
Fired when any of this object's ancestors change. First argument 'child' is the object whose parent changed. Second argument 'parent' is the first argument's new parent.
Thread safety: unsafe
AttributeChanged(stringattribute)
Thread safety: unsafe
Changed(stringproperty)
Fired after a property changes value. The property argument is the name of the property.
Thread safety: unsafe
ChildAdded(Instancechild)
Fired when a child is added to this Instance. child is the instance added.
Thread safety: unsafe
ChildRemoved(Instancechild)
Fired when a child is about to be removed from this Instance. child is the object being removed.
Thread safety: unsafe
DescendantAdded(Instancedescendant)
Fired after an Instance is parented to this object, or any of this object's descendants. The 'descendant' argument is the Instance that is being added.
Thread safety: unsafe
DescendantRemoving(Instancedescendant)
Fired after an Instance is unparented from this object, or any of this object's descendants. The 'descendant' argument is the Instance that is being unparented.