---
title: "FindFirstChildOfClass()"
description: "Finds the first direct child whose ClassName exactly matches the requested class."
canonical: "https://docs.glorpia.com/scripting/functions/find-first-child-of-class"
markdown: "https://docs.glorpia.com/scripting/functions/find-first-child-of-class.md"
---
# FindFirstChildOfClass()

Finds the first direct child whose ClassName exactly matches the requested class.

**Category:** Scripting / Method

## Syntax

```luau
instance:FindFirstChildOfClass(className)
```

## Parameters and return value

| Name | Type | Description |
| --- | --- | --- |
| `className` | string | Exact ClassName to search for among direct children. |
| `return` | Instance or nil | The first matching direct child, or nil when no match exists. |

> **Note:** This method searches direct children only. It does not have a recursive argument.

## Example: find a Humanoid

```luau
script.Parent.Touched:Connect(function(hit)
    local character = hit.Parent
    local humanoid = character and character:FindFirstChildOfClass("Humanoid")

    if humanoid then
        humanoid.Health = 0
    end
end)
```

## FindFirstChildOfClass vs IsA

`FindFirstChildOfClass()` compares the direct child's concrete `ClassName`. For example, searching for `"BasePart"` does not match a Part merely because `Part:IsA("BasePart")` is true.

## Related

- [FindFirstChild()](https://docs.glorpia.com/scripting/functions/find-first-child.md) — Find by child name, optionally recursively.
- [IsA()](https://docs.glorpia.com/scripting/functions/is-a.md) — Check concrete classes and supported base classes.
- [BasePart.Touched](https://docs.glorpia.com/scripting/events/touched.md) — A common place to locate a contacted character's Humanoid.
