Unofficial LSL Reference


Unofficial LSL reference

User Tools


You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.


Forgotten your password? Get a new one: Set new password

Function: llSameGroup

integer llSameGroup(key id)

Return whether the given object or avatar has the same active group as the current prim.



The key of an agent or a prim in the same region.


Returns TRUE if the user or object referenced by id is in the region and has the same group active as the prim with this script (including the group it's deeded to if deeded).

Returns FALSE if the assigned group differs, or if the user or object is not currently in the same region.


  • This function will also return TRUE if the user/object of key id has no active group, and the prim containing the script is not assigned to any group.
  • TRUE is also returned if this object is not assigned to any group, and the function is called with an argument of NULL_KEY.
  • When linking several prims each assigned to a different group, the group of each individual prim will be preserved. In that case, the group of the prim the script is on, is the one that counts for this function, thus making it possible to check several groups with one single object. The group the root prim is assigned to is the one that counts for building rights, etc. Note, also that if the object is then assigned to a new group, the groups in the individual prims will be lost. Re-rezzing or attaching the object will also cause the groups to be lost, and assigned to the current group of the rezzer (avatar or object).

Short examples

// Set Same to TRUE if the object owner's currently active group
// is the same as that which the prim is assigned to, and
// the owner is currently in the region, and to FALSE otherwise.
integer Same = llSameGroup(llGetOwner());

Complete examples

The following script will only allow people whose active group matches the object's group to sit on the prim. It will unsit them otherwise.

        llSitTarget(<0, 0, 1>, ZERO_ROTATION);

    changed(integer change)
        if (change & CHANGED_LINK)
            key id = llAvatarOnSitTarget();
            if (! llSameGroup(id))
                llRegionSayTo(id, 0, "This seat can only be used with the correct group tag active.");

See also

  • llDetectedGroup is a shortcut that can be used inside detection events.
  • llGetObjectDetails with OBJECT_GROUP can retrieve an object's group (not an avatar's though).