Instance
Instance is the base class for all classes in the Roblox class hierarchy which can be part of the DataModel tree.
Memory category | Instances |
---|
Member index 63
Removed member index 6
History | Member | |
---|---|---|
647 | ClassName: string | |
647 | className: string | |
647 | GetPropertyChangedSignal(property: string): RBXScriptSignal | |
647 | IsA(className: string): bool | |
647 | isA(className: string): bool | |
647 | Changed(property: string) |
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 Instance objects.
Instance has a special function called Instance.new() which is used to create objects via code. This function takes the name of the class as a parameter and returns the created object. Abstract classes and services cannot be created with the Instance.new function.
History 229
- 648 Change ReturnType of getChildren from Objects to Instances
- 648 Change ReturnType of children from Objects to Instances
- 648 Change ReturnType of GetChildren from Objects to Instances
- 647 Remove Changed
- 647 Remove isA
- 647 Remove IsA
- 647 Remove GetPropertyChangedSignal
- 647 Remove className
- 647 Remove ClassName
- 647 Change Superclass of Instance from <<<ROOT>>> to Object
- 641 Add GetStyled
- 635 Change ReadSecurity of Sandboxed from RobloxSecurity to RobloxScriptSecurity
- 635 Change Tags of Sandboxed from [NotReplicated, NotScriptable] to [NotReplicated]
- 635 Change WriteSecurity of Sandboxed from RobloxSecurity to RobloxScriptSecurity
- 635 Change ReadSecurity of Capabilities from RobloxSecurity to RobloxScriptSecurity
- 635 Change Tags of Capabilities from [NotScriptable] to []
- 635 Change WriteSecurity of Capabilities from RobloxSecurity to RobloxScriptSecurity
- 631 Change Tags of GetAttributes from [] to [CustomLuaState]
- 619 Add Sandboxed
- 619 Change Category of from Behavior to Permissions
- 619 Change Tags of Capabilities from [Hidden, NotScriptable] to [NotScriptable]
- 619 Change Category of Capabilities from Behavior to Permissions
- 616 Change Tags of UniqueId from [Hidden, NotReplicated, NotScriptable] to [NotReplicated, NotScriptable]
- 616 Change Tags of from [Hidden, NotReplicated] to [Hidden]
- 591 Add
- 591 Add Capabilities
- 580 Add ResetPropertyToDefault
- 580 Add IsPropertyModified
- 576 Add RemoveTag
- 576 Add HasTag
- 576 Add GetTags
- 576 Add AddTag
- 573 Change ReturnType of remove from void to null
- 573 Change ReturnType of destroy from void to null
- 573 Change ReturnType of SetAttribute from void to null
- 573 Change ReturnType of Remove from void to null
- 573 Change ReturnType of Destroy from void to null
- 573 Change ReturnType of ClearAllChildren from void to null
- 563 Change ThreadSafety of GetActor from Unsafe to Safe
- 553 Change PreferredDescriptor of childAdded from to ChildAdded
- 553 Change PreferredDescriptor of remove from to Remove
- 553 Change PreferredDescriptor of isDescendantOf from to IsDescendantOf
- 553 Change PreferredDescriptor of getChildren from to GetChildren
- 553 Change PreferredDescriptor of findFirstChild from to FindFirstChild
- 553 Change PreferredDescriptor of destroy from to Destroy
- 553 Change PreferredDescriptor of clone from to Clone
- 553 Change PreferredDescriptor of children from to GetChildren
- 553 Add
- 553 Change Default of className from to
- 553 Change PreferredDescriptor of className from to ClassName
- 553 Change PreferredDescriptor of from to Archivable
- 553 Change Default of from to
- 553 Add UniqueId
- 553 Add
- 553 Change Default of from to
- 553 Change Default of from to
- 553 Add
- 553 Change Default of Parent from to
- 553 Change Default of Name from to
- 553 Add
- 553 Change Default of from to
- 553 Change Default of ClassName from to
- 553 Add
- 553 Add
- 553 Add
- 553 Change Default of Archivable from to
- 525 Remove
- 522 Add
- 500 Add Destroying
- 486 Change ThreadSafety of IsDescendantOf from ReadOnly to Safe
- 486 Change ThreadSafety of IsAncestorOf from ReadOnly to Safe
- 486 Change ThreadSafety of IsA from ReadOnly to Safe
- 486 Change ThreadSafety of GetFullName from ReadOnly to Safe
- 486 Change ThreadSafety of GetDescendants from ReadOnly to Safe
- 486 Change ThreadSafety of GetChildren from ReadOnly to Safe
- 486 Change ThreadSafety of GetAttributes from ReadOnly to Safe
- 486 Change ThreadSafety of GetAttribute from ReadOnly to Safe
- 486 Change ThreadSafety of FindFirstDescendant from ReadOnly to Safe
- 486 Change ThreadSafety of FindFirstChildWhichIsA from ReadOnly to Safe
- 486 Change ThreadSafety of FindFirstChildOfClass from ReadOnly to Safe
- 486 Change ThreadSafety of FindFirstChild from ReadOnly to Safe
- 486 Change ThreadSafety of FindFirstAncestorWhichIsA from ReadOnly to Safe
- 486 Change ThreadSafety of FindFirstAncestorOfClass from ReadOnly to Safe
- 486 Change ThreadSafety of FindFirstAncestor from ReadOnly to Safe
- 486 Change ThreadSafety of className from ReadOnly to ReadSafe
- 486 Change ThreadSafety of from ReadOnly to ReadSafe
- 486 Change ThreadSafety of from ReadOnly to ReadSafe
- 486 Change ThreadSafety of from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Parent from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Name from ReadOnly to ReadSafe
- 486 Change ThreadSafety of from ReadOnly to ReadSafe
- 486 Change ThreadSafety of ClassName from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Archivable from ReadOnly to ReadSafe
- 483 Change ReturnType of GetActor from Instance to Actor
- 477 Add FindFirstDescendant
- 469 Change Tags of from [] to [Hidden]
- 469 Change Tags of from [ReadOnly, NotReplicated, Deprecated] to [Hidden, ReadOnly, NotReplicated, Deprecated]
- 462 Change ThreadSafety of childAdded from to Unsafe
- 462 Change ThreadSafety of DescendantRemoving from to Unsafe
- 462 Change ThreadSafety of DescendantAdded from to Unsafe
- 462 Change ThreadSafety of ChildRemoved from to Unsafe
- 462 Change ThreadSafety of ChildAdded from to Unsafe
- 462 Change ThreadSafety of Changed from to Unsafe
- 462 Change ThreadSafety of AttributeChanged from to Unsafe
- 462 Change ThreadSafety of AncestryChanged from to Unsafe
- 462 Change ThreadSafety of remove from to Unsafe
- 462 Change ThreadSafety of isDescendantOf from to Unsafe
- 462 Change ThreadSafety of isA from to Unsafe
- 462 Change ThreadSafety of getChildren from to Unsafe
- 462 Change ThreadSafety of findFirstChild from to Unsafe
- 462 Change ThreadSafety of destroy from to Unsafe
- 462 Change ThreadSafety of clone from to Unsafe
- 462 Change ThreadSafety of children from to Unsafe
- 462 Change ThreadSafety of WaitForChild from to Unsafe
- 462 Change ThreadSafety of SetAttribute from to Unsafe
- 462 Change ThreadSafety of Remove from to Unsafe
- 462 Change ThreadSafety of IsDescendantOf from to ReadOnly
- 462 Change ThreadSafety of IsAncestorOf from to ReadOnly
- 462 Change ThreadSafety of IsA from to ReadOnly
- 462 Change ThreadSafety of GetPropertyChangedSignal from to Unsafe
- 462 Change ThreadSafety of GetFullName from to ReadOnly
- 462 Change ThreadSafety of GetDescendants from to ReadOnly
- 462 Change ThreadSafety of GetDebugId from to Unsafe
- 462 Change ThreadSafety of GetChildren from to ReadOnly
- 462 Change ThreadSafety of GetAttributes from to ReadOnly
- 462 Change ThreadSafety of GetAttributeChangedSignal from to Unsafe
- 462 Change ThreadSafety of GetAttribute from to ReadOnly
- 462 Change ThreadSafety of GetActor from to Unsafe
- 462 Change ThreadSafety of FindFirstChildWhichIsA from to ReadOnly
- 462 Change ThreadSafety of FindFirstChildOfClass from to ReadOnly
- 462 Change ThreadSafety of FindFirstChild from to ReadOnly
- 462 Change ThreadSafety of FindFirstAncestorWhichIsA from to ReadOnly
- 462 Change ThreadSafety of FindFirstAncestorOfClass from to ReadOnly
- 462 Change ThreadSafety of FindFirstAncestor from to ReadOnly
- 462 Change ThreadSafety of Destroy from to Unsafe
- 462 Change ThreadSafety of Clone from to Unsafe
- 462 Change ThreadSafety of ClearAllChildren from to Unsafe
- 462 Change ThreadSafety of className from to ReadOnly
- 462 Change ThreadSafety of from to ReadOnly
- 462 Change ThreadSafety of from to ReadOnly
- 462 Change ThreadSafety of from to ReadOnly
- 462 Change ThreadSafety of Parent from to ReadOnly
- 462 Change ThreadSafety of Name from to ReadOnly
- 462 Change ThreadSafety of from to ReadOnly
- 462 Change ThreadSafety of ClassName from to ReadOnly
- 462 Change ThreadSafety of Archivable from to ReadOnly
- 455 Add GetActor
- 448 Add
- 408 Add AttributeChanged
- 408 Add SetAttribute
- 408 Add GetAttributes
- 408 Add GetAttributeChangedSignal
- 408 Add GetAttribute
- 390 Change Tags of from [ReadOnly, NotReplicated] to [ReadOnly, NotReplicated, Deprecated]
- 384 Change Tags of isA from [Deprecated] to [Deprecated, CustomLuaState]
- 384 Change Tags of IsA from [] to [CustomLuaState]
- 349 Change Tags of WaitForChild from [CanYield] to [CustomLuaState, CanYield]
- 349 Change Tags of GetDescendants from [] to [CustomLuaState]
- 329 Change ValueType of Parent from Object to Instance
- 311 Change WriteSecurity of from RobloxPlaceSecurity to LocalUserSecurity
- 311 Change ReadSecurity of from RobloxPlaceSecurity to LocalUserSecurity
- 303 Add GetDescendants
- 302 Change Parameters of FindFirstAncestor from (className: string) to (name: string)
- 301 Change Parameters of FindFirstAncestor from (name: string) to (className: string)
- 302 Change Parameters of FindFirstAncestor from (className: string) to (name: string)
- 298 Add FindFirstChildWhichIsA
- 298 Add FindFirstAncestorWhichIsA
- 298 Add FindFirstAncestorOfClass
- 298 Add FindFirstAncestor
- 292 Change Tags of from [Hidden, NotReplicated] to [Hidden, NotReplicated, Deprecated]
- 285 Add GetPropertyChangedSignal
- 284 Remove GetPropertyChangedSignal
- 285 Add GetPropertyChangedSignal
- 282 Remove GetPropertyChangedSignal
- 283 Add GetPropertyChangedSignal
- 259 Add FindFirstChildOfClass
- 251 Change Tags of WaitForChild from [Yields] to [CanYield]
- 251 Change Parameters of WaitForChild from (childName: string) to (childName: string, timeOut: double)
- 250 Change Tags of WaitForChild from [CanYield] to [Yields]
- 250 Change Parameters of WaitForChild from (childName: string, timeOut: double) to (childName: string)
- 251 Change Tags of WaitForChild from [Yields] to [CanYield]
- 251 Change Parameters of WaitForChild from (childName: string) to (childName: string, timeOut: double)
- 152 Change Security of GetDebugId from LocalUserSecurity to PluginSecurity
- 151 Change WriteSecurity of from LocalUserSecurity to PluginSecurity
- 151 Change ReadSecurity of from LocalUserSecurity to PluginSecurity
- 90 Add WaitForChild
- 85 Change ReadSecurity of from RobloxScriptSecurity to LocalUserSecurity
- 85 Change WriteSecurity of from RobloxScriptSecurity to LocalUserSecurity
- 84 Change WriteSecurity of from LocalUserSecurity to RobloxScriptSecurity
- 84 Change ReadSecurity of from LocalUserSecurity to RobloxScriptSecurity
- 83 Change ReadSecurity of from RobloxScriptSecurity to LocalUserSecurity
- 83 Change WriteSecurity of from RobloxScriptSecurity to LocalUserSecurity
- 52 Add destroy
- 50 Add childAdded
- 50 Add isDescendantOf
- 49 Change Tags of Remove from [] to [Deprecated]
- 49 Add Destroy
- 49 Add ClearAllChildren
- 49 Change Tags of className from [Hidden, ReadOnly, NotReplicated] to [ReadOnly, NotReplicated, Deprecated]
- 48 Add getChildren
- 47 Add DescendantRemoving
- 47 Add DescendantAdded
- 47 Add ChildRemoved
- 47 Add ChildAdded
- 47 Add Changed
- 47 Add AncestryChanged
- 47 Add remove
- 47 Add isA
- 47 Add findFirstChild
- 47 Add clone
- 47 Add children
- 47 Add Remove
- 47 Add IsDescendantOf
- 47 Add IsAncestorOf
- 47 Add IsA
- 47 Add GetFullName
- 47 Add GetDebugId
- 47 Add GetChildren
- 47 Add FindFirstChild
- 47 Add Clone
- 47 Add className
- 47 Add
- 47 Add
- 47 Add Parent
- 47 Add Name
- 47 Add
- 47 Add ClassName
- 47 Add Archivable
- 47 Add Instance
Members 63
AddTag
Parameters (1) | ||
---|---|---|
tag | string | |
Returns (1) | ||
null |
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.
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. Do this
when calling Instance:RemoveTag(), calling
Instance:Destroy(), or in a function connected to a signal
returned by CollectionService:GetInstanceRemovedSignal().
Thread safety | Unsafe |
---|
AncestryChanged
Parameters (2) | |
---|---|
child | Instance |
parent | Instance |
Fires when the Instance.Parent property of the object or one of its ancestors is changed.
This event includes two parameters, child and parent. Child refers to the Instance whose Instance.Parent was actually changed. Parent refers to this instance's new Instance.Parent.
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.
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of AncestryChanged from to Unsafe
- 47 Add AncestryChanged
Archivable
Type | Default | |
---|---|---|
bool |
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.
local part = Instance.new("Part")
print(part:Clone()) --> Part
part.Archivable = false
print(part:Clone()) --> nil
Thread safety | ReadSafe |
---|---|
Category | Behavior |
Loaded/Saved | false |
History 4
- 553 Change Default of Archivable from to
- 486 Change ThreadSafety of Archivable from ReadOnly to ReadSafe
- 462 Change ThreadSafety of Archivable from to ReadOnly
- 47 Add Archivable
AttributeChanged
Parameters (1) | |
---|---|
attribute | string |
This event fires whenever any attribute is changed on the instance,
including when an attribute is set to nil
. The name of the changed
attribute is passed to the connected function.
For example, the following code snippet connects the attributeChanged()
function to fire whenever one of the part's attributes changes:
1 2 3 4 5 6 7 |
|
See also Instance:GetAttributeChangedSignal() which returns an event that fires when a specific given attribute changes.
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of AttributeChanged from to Unsafe
- 408 Add AttributeChanged
Capabilities
Type | Default | |
---|---|---|
SecurityCapabilities |
The set of capabilities allowed to be used for scripts inside this instance. For the capabilities to take effect, Instance.Sandboxed property has to be enabled.
This property is used by an experimental feature. See Script Capabilities page for further details.
Security | RobloxScriptSecurity |
---|---|
Thread safety | ReadSafe |
Category | Permissions |
Loaded/Saved | true |
History 6
- 635 Change ReadSecurity of Capabilities from RobloxSecurity to RobloxScriptSecurity
- 635 Change Tags of Capabilities from [NotScriptable] to []
- 635 Change WriteSecurity of Capabilities from RobloxSecurity to RobloxScriptSecurity
- 619 Change Tags of Capabilities from [Hidden, NotScriptable] to [NotScriptable]
- 619 Change Category of Capabilities from Behavior to Permissions
- 591 Add Capabilities
ChildAdded
Parameters (1) | |
---|---|
child | Instance |
Fires after an object is parented to this Instance.
Note, when using this function 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:
workspace.ChildAdded:Connect(function(child)
-- need to use WaitForChild as descendants may not have replicated yet
local head = child:WaitForChild("Head")
end)
Note, this function only works for immediate children of the Instance. For a function that captures all descendants, use Instance.DescendantAdded.
See also, Instance.ChildRemoved.
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of ChildAdded from to Unsafe
- 47 Add ChildAdded
ChildRemoved
Parameters (1) | |
---|---|
child | Instance |
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 function only works for immediate children of the Instance. For a function that captures all descendants, use Instance.DescendantRemoving.
See also Instance.ChildAdded.
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of ChildRemoved from to Unsafe
- 47 Add ChildRemoved
ClearAllChildren
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
This function destroys all of an instance's children.
As Instance:Destroy() also calls itself on the children of an object it is used on, this function will destroy all descendants.
Alternatives to ClearAllChildren
If the developer does not wish to destroy all descendants, they should use Instance:GetChildren() or Instance:GetDescendants() to loop through an object and select what to destroy. For example, the following code sample will destroy all parts in an object.
for _, instance in object:GetDescendants() do
if instance:IsA("BasePart") then
instance:Destroy()
end
end
Thread safety | Unsafe |
---|
History 3
- 573 Change ReturnType of ClearAllChildren from void to null
- 462 Change ThreadSafety of ClearAllChildren from to Unsafe
- 49 Add ClearAllChildren
Clone
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Instance |
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 function 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 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 object that was not cloned, the same value is maintained in the copy.
Thread safety | Unsafe |
---|
DescendantAdded
Parameters (1) | |
---|---|
descendant | Instance |
The DescendantAdded event fires after a descendant is added to the Instance.
As DescendantAdded fires for every descendant, parenting an object to the Instance will fire the event for this object and all of its descendants individually.
Developers only concerned with the immediate children of the Instance should use Instance.ChildAdded instead.
See also Instance.DescendantRemoving.
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of DescendantAdded from to Unsafe
- 47 Add DescendantAdded
DescendantRemoving
Parameters (1) | |
---|---|
descendant | Instance |
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:
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.
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of DescendantRemoving from to Unsafe
- 47 Add DescendantRemoving
Destroy
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
Sets the Instance.Parent property to nil, locks the Instance.Parent property, disconnects all connections, and calls Destroy on all children. This function 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 (this is called a memory leak) which can lead to serious performance issues over time.
Tip: 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.
1 2 3 4 5 6 7 |
|
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, set Parent it to nil instead. For example:
object.Parent = nil
wait(2)
object.Parent = workspace
To Destroy an object after a set amount of time, use Debris:AddItem().
Thread safety | Unsafe |
---|
Destroying
Parameters (0) | ||
---|---|---|
No parameters. |
The Instance will never be deleted from memory while a connected
function is still using it. However, if the function yields at any point,
the Instance and its descendants will be parented to nil
.
If the Workspace.SignalBehavior property is set to SignalBehavior.Immediate, this event fires immediately before the Instance or one of its ancestors is destroyed with Instance:Destroy().
If the Workspace.SignalBehavior property is set to SignalBehavior.Deferred, this event fires at the next resumption point, which will be after the Instance or one of its ancestors is destroyed with Instance:Destroy().
With Deferred behavior, connecting a script to its own Instance.Destroying event is problematic, as the script will be destroyed before the callback can be called (meaning it will not execute).
When deleting an Instance in Studio, such as manually deleting
through the Explorer or through a plugin,
the Instance isn't destroyed. Instead, the parent is set to nil
which you can track with Instance.AncestryChanged.
Thread safety | Unsafe |
---|
History 1
- 500 Add Destroying
FindFirstAncestor
Parameters (1) | ||
---|---|---|
name | string | |
Returns (1) | ||
Instance |
Returns the first ancestor of the Instance whose Instance.Name is equal to the given name.
This function 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 function that find ancestors of a specific class, please see Instance:FindFirstAncestorOfClass() and Instance:FindFirstAncestorWhichIsA().
Thread safety | Safe |
---|
History 6
- 486 Change ThreadSafety of FindFirstAncestor from ReadOnly to Safe
- 462 Change ThreadSafety of FindFirstAncestor from to ReadOnly
- 302 Change Parameters of FindFirstAncestor from (className: string) to (name: string)
- 301 Change Parameters of FindFirstAncestor from (name: string) to (className: string)
- 302 Change Parameters of FindFirstAncestor from (className: string) to (name: string)
- 298 Add FindFirstAncestor
FindFirstAncestorOfClass
Parameters (1) | ||
---|---|---|
className | string | |
Returns (1) | ||
Instance |
Returns the first ancestor of the Instance whose Object.ClassName is equal to the given className.
This function 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 function is finding the Model a BasePart belongs to. For example:
local model = part:FindFirstAncestorOfClass("Model")
This function 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.
Thread safety | Safe |
---|
History 3
- 486 Change ThreadSafety of FindFirstAncestorOfClass from ReadOnly to Safe
- 462 Change ThreadSafety of FindFirstAncestorOfClass from to ReadOnly
- 298 Add FindFirstAncestorOfClass
FindFirstAncestorWhichIsA
Parameters (1) | ||
---|---|---|
className | string | |
Returns (1) | ||
Instance |
Returns the first ancestor of the Instance for whom Object:IsA() returns true for the given className.
This function 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 function 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().
Thread safety | Safe |
---|
History 3
- 486 Change ThreadSafety of FindFirstAncestorWhichIsA from ReadOnly to Safe
- 462 Change ThreadSafety of FindFirstAncestorWhichIsA from to ReadOnly
- 298 Add FindFirstAncestorWhichIsA
FindFirstChild
Parameters (2) | Default | |
---|---|---|
name | string | |
recursive | bool | false |
Returns (1) | ||
Instance |
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 function 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.
1 2 |
|
Use FindFirstChild to first check for Part, then use an if-statement to run code that needs it.
1 2 3 4 |
|
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. Part.Color refers to the Color3, not the Folder.
1 2 3 4 5 6 |
|
A benefit of using FindFirstChild() in this way is that the introduction of new properties does not impose a risk on your code.
Performance Note
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.
Thread safety | Safe |
---|
History 3
- 486 Change ThreadSafety of FindFirstChild from ReadOnly to Safe
- 462 Change ThreadSafety of FindFirstChild from to ReadOnly
- 47 Add FindFirstChild
FindFirstChildOfClass
Parameters (1) | ||
---|---|---|
className | string | |
Returns (1) | ||
Instance |
Returns the first child of the Instance whose ClassName is equal to the given className.
If no matching child is found, this function returns nil.
Unlike Instance:FindFirstChildWhichIsA() this function uses only returns objects whose class matches the given className, ignoring class inheritance.
Developers looking for a child by name should use Instance:FindFirstChild() instead.
Thread safety | Safe |
---|
History 3
- 486 Change ThreadSafety of FindFirstChildOfClass from ReadOnly to Safe
- 462 Change ThreadSafety of FindFirstChildOfClass from to ReadOnly
- 259 Add FindFirstChildOfClass
FindFirstChildWhichIsA
Parameters (2) | Default | |
---|---|---|
className | string | |
recursive | bool | false |
Returns (1) | ||
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 function returns nil. If the optional recursive argument is true, this function searches all descendants rather than only the immediate children of the Instance.
Unlike Instance:FindFirstChildOfClass(), this function uses Object:IsA() which respects class inheritance. For example:
1 2 3 |
|
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.
Thread safety | Safe |
---|
History 3
- 486 Change ThreadSafety of FindFirstChildWhichIsA from ReadOnly to Safe
- 462 Change ThreadSafety of FindFirstChildWhichIsA from to ReadOnly
- 298 Add FindFirstChildWhichIsA
FindFirstDescendant
Parameters (1) | ||
---|---|---|
name | string | |
Returns (1) | ||
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.
Thread safety | Safe |
---|
History 2
- 486 Change ThreadSafety of FindFirstDescendant from ReadOnly to Safe
- 477 Add FindFirstDescendant
GetActor
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Actor |
If the Instance is an Actor, the Actor itself is
returned. Otherwise, its closest ancestor Actor is returned. If no
ancestor is an Actor, the result is nil
.
Thread safety | Safe |
---|
GetAttribute
Parameters (1) | ||
---|---|---|
attribute | string | |
Returns (1) | ||
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:
1 2 3 4 5 |
|
See Also
- Instance:SetAttribute() which sets the attribute with the given name to the given value.
- Instance:GetAttributes() which returns a dictionary of key‑value pairs for each of the instance's attributes.
Thread safety | Safe |
---|
History 3
- 486 Change ThreadSafety of GetAttribute from ReadOnly to Safe
- 462 Change ThreadSafety of GetAttribute from to ReadOnly
- 408 Add GetAttribute
GetAttributeChangedSignal
Parameters (1) | ||
---|---|---|
attribute | string | |
Returns (1) | ||
RBXScriptSignal |
This function 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:
1 2 3 4 5 6 7 8 |
|
See also Instance.AttributeChanged which fires whenever any attribute is changed on the instance.
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of GetAttributeChangedSignal from to Unsafe
- 408 Add GetAttributeChangedSignal
GetAttributes
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Dictionary |
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:
1 2 3 4 5 6 7 |
|
See also Instance:GetAttribute() which returns the value that has been assigned to the given attribute name.
Thread safety | Safe |
---|
History 4
- 631 Change Tags of GetAttributes from [] to [CustomLuaState]
- 486 Change ThreadSafety of GetAttributes from ReadOnly to Safe
- 462 Change ThreadSafety of GetAttributes from to ReadOnly
- 408 Add GetAttributes
GetChildren
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Instances |
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:
1 2 3 4 5 6 |
|
1 2 3 4 5 |
|
The children are sorted by the order in which their Parent property was set to the object.
See also the GetDescendants function.
Thread safety | Safe |
---|
History 4
- 648 Change ReturnType of GetChildren from Objects to Instances
- 486 Change ThreadSafety of GetChildren from ReadOnly to Safe
- 462 Change ThreadSafety of GetChildren from to ReadOnly
- 47 Add GetChildren
GetDebugId
Parameters (1) | Default | |
---|---|---|
scopeLength | int | 4 |
Returns (1) | ||
string |
Returns a coded string of the debug ID used internally by Roblox.
Note:
- 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)
Security | PluginSecurity |
---|---|
Thread safety | Unsafe |
History 3
- 462 Change ThreadSafety of GetDebugId from to Unsafe
- 152 Change Security of GetDebugId from LocalUserSecurity to PluginSecurity
- 47 Add GetDebugId
GetDescendants
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Array |
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.
Thread safety | Safe |
---|
History 4
- 486 Change ThreadSafety of GetDescendants from ReadOnly to Safe
- 462 Change ThreadSafety of GetDescendants from to ReadOnly
- 349 Change Tags of GetDescendants from [] to [CustomLuaState]
- 303 Add GetDescendants
GetFullName
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
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 function considers all ancestors up to and including the topmost one without a Parent.
This function is useful for logging and debugging. You shouldn't attempt to parse the returned string for any useful operation; this function does not escape periods (or any other symbol) in object names. In other words, although its output often appears to be a valid Lua identifier, it is not guaranteed.
Thread safety | Safe |
---|
History 3
- 486 Change ThreadSafety of GetFullName from ReadOnly to Safe
- 462 Change ThreadSafety of GetFullName from to ReadOnly
- 47 Add GetFullName
GetStyled
Parameters (1) | ||
---|---|---|
name | string | |
Returns (1) | ||
Variant |
Thread safety | Unsafe |
---|
GetTags
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Array |
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.
Thread safety | Safe |
---|
HasTag
Parameters (1) | ||
---|---|---|
tag | string | |
Returns (1) | ||
bool |
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().
Thread safety | Safe |
---|
IsAncestorOf
Parameters (1) | ||
---|---|---|
descendant | Instance | |
Returns (1) | ||
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().
Thread safety | Safe |
---|
History 3
- 486 Change ThreadSafety of IsAncestorOf from ReadOnly to Safe
- 462 Change ThreadSafety of IsAncestorOf from to ReadOnly
- 47 Add IsAncestorOf
IsDescendantOf
Parameters (1) | ||
---|---|---|
ancestor | Instance | |
Returns (1) | ||
bool |
Returns true if an Instance is a descendant of the given ancestor.
An Instance is considered the descendant of an object if the instance's parent or one of its parent's parent is set to the object.
Note, DataModel is a descendant of nil. This means IsDescendantOf cannot be used with a parameter of nil to check if an object has been removed.
See also, Instance:IsAncestorOf().
Thread safety | Safe |
---|
History 3
- 486 Change ThreadSafety of IsDescendantOf from ReadOnly to Safe
- 462 Change ThreadSafety of IsDescendantOf from to ReadOnly
- 47 Add IsDescendantOf
IsPropertyModified
Parameters (1) | ||
---|---|---|
name | string | |
Returns (1) | ||
bool |
Thread safety | Unsafe |
---|
History 1
Name
Type | Default | |
---|---|---|
string |
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 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 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().
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
Parent
Type | Default | |
---|---|---|
Instance |
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, though it is not recommended
Instance.new("NumberValue", workspace)
When a change is made to certain properties while an instance is parented in the DataModel, the engine may need to perform extra work internally (for things like replication, rendering, and GUI layout). Whenever possible, change an instance's properties before you set its Parent, rather than after, to avoid performing that work redundantly.
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 then setting many properties, it's recommended to set Parent last. This ensures the object replicates once, instead of replicating many property changes.
1 2 3 4 5 6 |
|
However, if you were parenting your parts to a Model whose parent hasn't been set yet, then parenting each part to that model is okay as the model would not have replicated yet.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true/false |
Remove
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
The Remove function sets the object's Instance.Parent to nil, and does the same for all its descendants.
If the object is referenced before being removed it is possible to retrieve the object at a later point.
Thread safety | Unsafe |
---|
RemoveTag
Parameters (1) | ||
---|---|---|
tag | string | |
Returns (1) | ||
null |
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.
Thread safety | Unsafe |
---|
ResetPropertyToDefault
Parameters (1) | ||
---|---|---|
name | string | |
Returns (1) | ||
null |
Thread safety | Unsafe |
---|
History 1
Sandboxed
Type | Default | |
---|---|---|
bool |
Turns the instance to be a Sandboxed Container. Sandboxed Containers are an experimental feature which limits the actions that scripts inside a particular container can perform.
See Script Capabilities page for further details.
Security | RobloxScriptSecurity |
---|---|
Thread safety | ReadSafe |
Category | Permissions |
Loaded/Saved | false |
SetAttribute
Parameters (2) | ||
---|---|---|
attribute | string | |
value | Variant | |
Returns (1) | ||
null |
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 Vector3.new(0, 10, 0):
1 2 |
|
Limitations
Naming requirements and restrictions:
- Names must only use alphanumeric characters and underscore.
- No spaces or unique symbols 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:
- Instance:GetAttribute() which returns the value that has been assigned to the given attribute name.
- Instance:GetAttributes() which returns a dictionary of key‑value pairs for each of the instance's attributes.
Thread safety | Unsafe |
---|
History 3
- 573 Change ReturnType of SetAttribute from void to null
- 462 Change ThreadSafety of SetAttribute from to Unsafe
- 408 Add SetAttribute
UniqueId
Type | Default | |
---|---|---|
UniqueId |
Security | RobloxSecurity |
---|---|
Thread safety | ReadSafe |
Category | Data |
Loaded/Saved | true |
WaitForChild
Parameters (2) | ||
---|---|---|
childName | string | |
timeOut | double | |
Returns (1) | ||
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 function 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.
Thread safety | Unsafe |
---|
History 9
- 462 Change ThreadSafety of WaitForChild from to Unsafe
- 349 Change Tags of WaitForChild from [CanYield] to [CustomLuaState, CanYield]
- 251 Change Tags of WaitForChild from [Yields] to [CanYield]
- 251 Change Parameters of WaitForChild from (childName: string) to (childName: string, timeOut: double)
- 250 Change Tags of WaitForChild from [CanYield] to [Yields]
- 250 Change Parameters of WaitForChild from (childName: string, timeOut: double) to (childName: string)
- 251 Change Tags of WaitForChild from [Yields] to [CanYield]
- 251 Change Parameters of WaitForChild from (childName: string) to (childName: string, timeOut: double)
- 90 Add WaitForChild
childAdded
Parameters (1) | |
---|---|
child | Instance |
Thread safety | Unsafe |
---|
History 3
- 553 Change PreferredDescriptor of childAdded from to ChildAdded
- 462 Change ThreadSafety of childAdded from to Unsafe
- 50 Add childAdded
children
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Instances |
The children function returns an array of the object's children.
Thread safety | Unsafe |
---|
clone
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Instance |
Thread safety | Unsafe |
---|
destroy
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
Thread safety | Unsafe |
---|
findFirstChild
Parameters (2) | Default | |
---|---|---|
name | string | |
recursive | bool | false |
Returns (1) | ||
Instance |
Thread safety | Unsafe |
---|
History 3
- 553 Change PreferredDescriptor of findFirstChild from to FindFirstChild
- 462 Change ThreadSafety of findFirstChild from to Unsafe
- 47 Add findFirstChild
getChildren
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Instances |
Thread safety | Unsafe |
---|
History 4
- 648 Change ReturnType of getChildren from Objects to Instances
- 553 Change PreferredDescriptor of getChildren from to GetChildren
- 462 Change ThreadSafety of getChildren from to Unsafe
- 48 Add getChildren
isDescendantOf
Parameters (1) | ||
---|---|---|
ancestor | Instance | |
Returns (1) | ||
bool |
Thread safety | Unsafe |
---|
History 3
- 553 Change PreferredDescriptor of isDescendantOf from to IsDescendantOf
- 462 Change ThreadSafety of isDescendantOf from to Unsafe
- 50 Add isDescendantOf
remove
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
Thread safety | Unsafe |
---|
Removed members 6
Changed
Parameters (1) | |
---|---|
property | string |
Thread safety | Unsafe |
---|
ClassName
Type | Default | |
---|---|---|
string |
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | false |
GetPropertyChangedSignal
Parameters (1) | ||
---|---|---|
property | string | |
Returns (1) | ||
RBXScriptSignal |
Thread safety | Unsafe |
---|
History 7
- 647 Remove GetPropertyChangedSignal
- 462 Change ThreadSafety of GetPropertyChangedSignal from to Unsafe
- 285 Add GetPropertyChangedSignal
- 284 Remove GetPropertyChangedSignal
- 285 Add GetPropertyChangedSignal
- 282 Remove GetPropertyChangedSignal
- 283 Add GetPropertyChangedSignal
IsA
Parameters (1) | ||
---|---|---|
className | string | |
Returns (1) | ||
bool |
Thread safety | Safe |
---|
className
Type | Default | |
---|---|---|
string |
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | false |
History 7
- 647 Remove className
- 553 Change Default of className from to
- 553 Change PreferredDescriptor of className from to ClassName
- 486 Change ThreadSafety of className from ReadOnly to ReadSafe
- 462 Change ThreadSafety of className from to ReadOnly
- 49 Change Tags of className from [Hidden, ReadOnly, NotReplicated] to [ReadOnly, NotReplicated, Deprecated]
- 47 Add className
isA
Parameters (1) | ||
---|---|---|
className | string | |
Returns (1) | ||
bool |
Thread safety | Unsafe |
---|