Property of Object Icon.pngInstance
There are members of the same name. See the disambiguation page.

Value Type: string
Description: 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 can be used to access the object through the data model hierarchy using the dot . operator. For example, game.Workspace.Baseplate will access the baseplate part in a default place. In order to make an object accessible using the . operator, an object's Name must follow a certain syntax. The object’s 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 object’s name does not follow this syntax it will not be accessible using the . 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 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.

If an object's Name is equal to the name of a member (property/function/etc.) of its Parent, using the . operator on the parent will give reference the member instead of the the object with that Name. For this reason FindFirstChild is preferred over indexing when the Name of the object might vary (e.g. Player names).


local brick = Instance.new("Part")
brick.Name = "Brick"
brick.Parent = game.Workspace
-- Change the part's name
brick.Name = "Brick2"
-- Now the brick can be found using "game.Workspace.Brick2"
local brick2 = game.Workspace.Brick2
print(brick2 == brick)
--> true
local brick3 = game.Workspace.Brick
-- This code errors because there is no longer an object with Name "Brick" in the workspace