> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# getactorfromthread

> Returns the Actor Instance associated with a Luau thread. The first argument must be a thread. The function reads the thread's thread data, requires a Actor reference and a positive container count, then reads the associated Actor. If the actor weak reference is valid, it is pushed as an Instance; otherwise the function returns nil.

Returns the Actor Instance associated with a Luau thread. The first argument must be a thread. The function reads the thread's thread data, requires a Actor reference and a positive container count, then reads the associated Actor. If the actor weak reference is valid, it is pushed as an Instance; otherwise the function returns nil.

## Syntax

```lua theme={null}
getactorfromthread(thread: thread): Instance | nil
```

## Aliases

* `getactorfromstate`

## Arguments

| Name     | Type     | Required | Description                                                                             |
| -------- | -------- | -------- | --------------------------------------------------------------------------------------- |
| `thread` | `thread` | Yes      | Luau thread whose thread data should be checked for an associated Actor weak reference. |

## Returns

| Name    | Type              | Description                                                                                                                     |
| ------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `actor` | `Instance \| nil` | Actor Instance resolved from the thread's the associated Actor weak reference, or nil when no valid actor reference is present. |

## Example

Resolve the Actor Instance associated with a Luau thread, when that thread has a valid actor reference.

```lua theme={null}
for _, thread in ipairs(getactorthreads()) do
    local actor = getactorfromthread(thread)
    print(actor)
end
```
