> ## 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.

# compareinstances

> Compares the Instance references stored in two Instance object values.

Compares the Instance references stored in two Instance object values.

## Syntax

```lua theme={null}
compareinstances(first: Instance, second: Instance): boolean
```

## Arguments

| Name     | Type       | Required | Description                        |
| -------- | ---------- | -------- | ---------------------------------- |
| `first`  | `Instance` | Yes      | First Instance object to compare.  |
| `second` | `Instance` | Yes      | Second Instance object to compare. |

## Returns

| Name    | Type      | Description                                                                  |
| ------- | --------- | ---------------------------------------------------------------------------- |
| `equal` | `boolean` | True when both Instance object values contain the same underlying reference. |

## Example

Compare the underlying Instance references.

```lua theme={null}
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

print(compareinstances(Players, Players))
print(compareinstances(Players, ReplicatedStorage))
```
