# llGetOwnerKey

*LSL function*

```lsl
key key llGetOwnerKey(key id);
```

- `key id`: UUID of the prim in the same region.

- Returns: `key`
- Energy: 10

Returns the key (UUID) of the owner of the prim specified by id.

Returns a [key](https://wiki.secondlife.com/wiki/key) that is the owner of prim **id**

```lsl title="How to use" frame="terminal"
key result = llGetOwnerKey(NULL_KEY);
```

## Caveats

- Returns **id** if **id** is not found in the region or is not a prim.
- Owner information becomes unavailable *immediately* on derez or detach. For example, if a prim chats at derez or detach time, **id** can be returned even inside [listen](/events/listen/) events of nearby objects. <sup>[SVC-5095](https://jira.secondlife.com/browse/SVC-5095)</sup>
- Also returns **id** for avatars, use [llGetAgentSize](/functions/llGetAgentSize/) instead to distinguish them from prims that do not exist.
- Returns [NULL_KEY](/constants/NULL_KEY/) if the id passed in is not a valid key

## Examples

<details open>
<summary>Example 1</summary>

```lsl collapse={1-10, 16-22}
default
{
    state_entry()
    {
    //  listen to anything talking on channel 1
        llListen(1, "", NULL_KEY, "");
    //  Type "/1 " + message (such as "/1 poke") to chat 'message' on channel 1.
    }

    listen(integer channel, string name, key id, string message)
    {
        key ownerOfThisObject = llGetOwner();
        key ownerOfSpeaker = llGetOwnerKey(id);

    //  if whoever is talking is the owner of this object
    //  or if the owner of the object talking is the owner of this object
        if (ownerOfSpeaker == ownerOfThisObject)
        {
            llOwnerSay("'" + name + "' has the same owner as me ^_^");
        }
    }
}
```

</details>

## See also

### Functions

- [llKey2Name](/functions/llKey2Name/)
- [llRequestAgentData](/functions/llRequestAgentData/)
- [llGetObjectDetails](/functions/llGetObjectDetails/) — [OBJECT_OWNER](/constants/OBJECT_OWNER/)
- [llGetOwner](/functions/llGetOwner/)

---

*Source: [LlGetOwnerKey](https://wiki.secondlife.com/wiki/LlGetOwnerKey) on the Second Life Wiki. Content from the Second Life Wiki articles LlGetOwnerKey (revision 1206282, 2017-09-25) and Template:LSL Function/prim (revision 1168829, 2012-06-11), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llGetOwnerKey/
