WorkSpace||doc136795

September 20, 2022

WorkSpace

Workspace instances are automatically created when creating scenes, and cannot be created through code

Brief Introduction

Workspace inherits from instance and has no additional functions. The main purpose of the workspace is to manage instances in the scene. The workspace is the root node of the scene. You can use theScene RootAccess the workspace of the scene.

Attribute

Inherited FromInstance

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

Inherited FromInstance

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

event

Inherited FromInstance

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