We use cookies on this site to enhance your user experience
Collapse Sidebar


IsA returns true if the Instance's class is equivalent to or a subclass of a given class. This function is similar to the instanceof operators in other languages, and is a form of type introspection. To ignore class inheritance, test the Instance/ClassName|ClassName property directly instead. For checking native Lua data types (number, string, etc) use the functions type and typeof.

Most commonly, this function is used to test if an object is some kind of part, such as Part or WedgePart, which inherits from BasePart (an abstract class). For example, if your goal is to change all of a Player/Character|Character's limbs to the same color, you might use Instance/GetChildren|GetChildren to iterate over the children, then use IsA to filter non-BasePart objects which lack the BrickColor property:

local function paintFigure(character, color)
	-- Iterate over the child objects of the character
	for _, child in pairs(character:GetChildren()) do
		-- Filter out non-part objects, such as Shirt, Pants and Humanoid
		-- R15 use MeshPart and R6 use Part, so we use BasePart here to detect both:
		if child:IsA("BasePart") then
			child.BrickColor = color
paintFigure(game.Players.Player.Character, BrickColor.new("Bright blue"))

Since all classes inherit from Instance, calling object:IsA("Instance") will always return true.


Name Type Default Description

The class against which the Instance’s class will be checked. Case-sensitive.


Return Type Summary

Describes whether the Instance’s class matched or is a subclass of the given class

Code Samples


Usage of IsA to test class inheritance:

print(Workspace:IsA("Instance" )) --> true
print(Workspace:IsA("Workspace")) --> true
print(game:IsA("Workspace")) --> false
print(game:IsA("DataModel")) --> true