Instance||doc136276

September 20, 2022

Instance

This abstract class object cannot be created

Brief Introduction

In Blockman GO scene, Instance is the abstract base class of all instance classes. All instances created in the scene tree inherits from Instance. Instance class includes the most basic name, type, ID and other information. The main function is to find, add, delete and other operations related to the parent-child level. Instance.newTo create.

The types of instances that can be created are:

Part Decal Folder WeldConstraint

Constructor

Instance Instance.newstring className, Instance parent, table<string, variant> params )
Create a specific type of instance object

Attribute

string Name
Name of the instance
Instance Parent
Parent of the instance
Map Map [ReadOnly]
Scenario of the instance
string ClassName [ReadOnly]
Class name of the instance
int ID [ReadOnly]
Unique ID of the instance

Function

bool IsValid()
Get whether the instance object reference is valid
void Destroy()
Destroy instance
Instance Clone()
Clone the current instance
bool IsAncestorOfInstance instance )
Get whether it is the ancestor of an instance
bool IsDescendantOfInstance instance )
Get whether it is a descendant of an instance
bool IsClassstring className )
Get whether the instance type is a certain type
Instance FindFirstAncestorstring name )
Get the ancestor node instance by name
Instance FindFirstAncestorByClassstring className )
Get the ancestor node instance according to the type name
Instance FindFirstChildstring name, bool recursive )
Get child node instances by name
Instance FindFirstChildByClassstring name, bool recursive )
Get the child node instance according to the type name
table<Instance> GetChildrenbool recursive )
Get all child node instances
void AddChildInstance instance )
Add an instance to a child
void DestroyAllChildren()
Destroy all child node instances
BindableEvent GetEventstring eventName )
Get the bindable event of the instance

Static function

Instance Instance.GetInstanceByIDint id )
Get instance based on unique ID

event

BindableEvent OnChildAdded
Triggered after adding child nodes to the instance
BindableEvent OnChildRemoved
Triggered after removing child nodes from an instance
BindableEvent OnDestroy
Triggered when the instance is about to be destroyed