IsClass||doc136410

September 20, 2022

Format

Instance:IsClass(className)

Describe

Gets whether the instance is of a certain type. Returns true when the instance type is equal to or inherits from the parameter type.

parameter

Variable name Type Describe
instance Instance Instance object

Return value

Type Describe
bool Is it an ancestor

Code example

local part1 = Instance.new("Part")
local part2 = Instance.new("Part", part1)
local part3 = Instance.new("Part", part2)

print(part1:IsAncestorOf(part2))
print(part1:IsAncestorOf(part3))
print(part2:IsAncestorOf(part3))