# llGetRegionAgentCount

*LSL function*

```lsl
integer integer llGetRegionAgentCount();
```

- Returns: `integer`
- Energy: 10

Returns an integer representing the current number of avatars in the region.

Returns an [integer](https://wiki.secondlife.com/wiki/integer) that is the number of avatars in the region.

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

## Caveats

- The value returned by this function is technically the average number of agents who were in the region for the past second, rounded to the nearest integer. This means that there is a slight (&lt;1 second) delay in agent count when an agent enters or exits a region.

## Examples

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

```lsl
default
{
    touch_start(integer num_detected)
    {
        integer numberOfAvatarsInSim = llGetRegionAgentCount();
        llSay(0, "There are currently "
            + (string) numberOfAvatarsInSim + " avatars in this sim.");
    }
}
```

</details>

## History

- Introduced in SVN:568 r88085 Branch:Release Wednesday, 21 May 2008
- Date of Release [16-10-2008](https://wiki.secondlife.com/wiki/Release_Notes/Second_Life_Release/1.21)

## See also

### Functions

- [llGetAgentList](/functions/llGetAgentList/)
- [llGetRegionFPS](/functions/llGetRegionFPS/)
- [llGetRegionTimeDilation](/functions/llGetRegionTimeDilation/)

---

*Source: [LlGetRegionAgentCount](https://wiki.secondlife.com/wiki/LlGetRegionAgentCount) on the Second Life Wiki. Content from the Second Life Wiki article LlGetRegionAgentCount (revision 1194241, 2015-01-22), CC BY-SA 3.0.*

---

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