# llAgentInExperience

*LSL function (requires an experience)*

```lsl
integer integer llAgentInExperience(key agent);
```

- `key agent`: UUID of the avatar in the same region to query.

- Returns: `integer`
- Energy: 10

Determines whether or not the specified **agent** is in the script's experience.

Returns an [integer](https://wiki.secondlife.com/wiki/integer) that is [TRUE](/constants/TRUE/) if the **agent** is in the experience and the experience can run in the current region.

```lsl title="How to use" frame="terminal"
integer result = llAgentInExperience(NULL_KEY);
```

## Caveats

- Agent must be over a parcel that has the Experience allowed or [FALSE](/constants/FALSE/) is returned with Land Scope Experience compiled scripts.

## Examples

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

```lsl
default
{
  touch_start(integer total_number)
  {
    if(llAgentInExperience(llDetectedKey(0)))
    {
      llOwnerSay(llDetectedName(0)+ " is in my experience");
    }
    else
    {
      llOwnerSay(llDetectedName(0)+ " is not in my experience");
    }
  }
}
```

</details>

## See also

### Functions

- [llGetExperienceDetails](/functions/llGetExperienceDetails/)

---

*Source: [LlAgentInExperience](https://wiki.secondlife.com/wiki/LlAgentInExperience) on the Second Life Wiki. Content from the Second Life Wiki articles LlAgentInExperience (revision 1216629, 2024-05-05) and Template:LSL Function/avatar (revision 1179236, 2013-06-15), CC BY-SA 3.0.*

---

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