# llDetectedGroup

*LSL function*

```lsl
integer integer llDetectedGroup(integer number);
```

- `integer number`: Index of the detection information.

- Returns: `integer`
- Energy: 10

Returns TRUE if the detected object or avatar specified by number has the same active group as the prim containing the script. Returns FALSE if the group is not active or if they are not in the group.

Returns [FALSE](/constants/FALSE/) if **number** is out of range.

Returns an [integer](https://wiki.secondlife.com/wiki/integer) that is [TRUE](/constants/TRUE/) if the detected [object](https://wiki.secondlife.com/wiki/object) or [agent](/constants/AGENT/) has the same *active* [group](https://wiki.secondlife.com/wiki/group) as the [prim](https://wiki.secondlife.com/wiki/prim) containing the script. Otherwise [FALSE](/constants/FALSE/) is returned.

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

## Caveats

- There is no way to detect if the prim is in the same group as one of the agent's inactive groups.

## Examples

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

```lsl
//Gives inventory only to agents with the same active group
default
{
    touch_start(integer total_number)
    {
        if (llDetectedGroup(0) )     //same as llSameGroup(llDetectedKey(0) ) (with llSameGroup, detected must be in the sim)
            llGiveInventory(llDetectedKey(0), llGetInventoryName(INVENTORY_OBJECT, 0) );
        else
            llSay(0, "Wrong active group!");
    }
}
```

</details>

## See also

### Functions

- [llSameGroup](/functions/llSameGroup/)

---

*Source: [LlDetectedGroup](https://wiki.secondlife.com/wiki/LlDetectedGroup) on the Second Life Wiki. Content from the Second Life Wiki articles LlDetectedGroup (revision 1218165, 2025-04-09), Template:LSL Function/group (revision 1209759, 2020-12-15) and Template:LSL Function/detected (revision 1168823, 2012-06-11), CC BY-SA 3.0.*

---

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