PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. To see our new and improved documentation, please click here. You can read more about the future of documentation here.
Collapse Sidebar

ClassName

Instance

string

A read-only string representing the class this Instance belongs to.

This property can be used with various other functions of Instance that are used to identify objects by type, such as Instance/IsA or Instance/FindFirstChildOfClass.

Note this property is read only and cannot be altered by scripts. Developers wishing to change an Instance’s class will instead have to create a new Instance.

Unlike Instance/IsA, ClassName can be used to check if an object belongs to a specific class ignoring class inheritance. For example:

for _, child in ipairs(game.Workspace:GetChildren()) do
    if child.ClassName == "Part" then
        print("Found a Part")
        -- will find Parts in model, but NOT TrussParts, WedgeParts, etc
    end
end