# llSitOnLink

*LSL function (requires an experience)*

```lsl
integer integer llSitOnLink(key agent_id, integer link);
```

- `key agent_id`: UUID of the avatar being forced to sit.
- `integer link`: Link number for the prim containing the desired sit target.

- Returns: `integer`
- Energy: 10

The avatar specified by **agent_id** is forced to sit on the sit target of the prim indicated by the **link** parameter. If the specified link is already occupied, the simulator searches down the chain of prims in the link set looking for an available sit target.

If successful, this method returns [SIT_OK](/constants/SIT_OK/).

If the function fails, it returns a negative number constant.

Link constants that indicate a single prim may be used for the **link** parameter. These are [LINK_ROOT](/constants/LINK_ROOT/) and [LINK_THIS](/constants/LINK_THIS/). Other constants such as [LINK_SET](/constants/LINK_SET/), LINK_CHILDREN, [LINK_ALL_OTHERS](/constants/LINK_ALL_OTHERS/) will return an INVALID_LINK error.

***This method must be called from an experience enabled script running on land that has enabled the experience key.*** If these conditions are not met this method returns a NOT_EXPERIENCE error.

The targeted avatar must also have accepted the experience. If the user is not participating in the experience this method returns NO_EXPERIENCE_PERMISSION. If the avatar id can not be found or is not over land that has enabled the experience this method returns INVALID_AGENT.

If there are no valid sit targets remaining in the linkset this method returns NO_SIT_TARGET and no action is taken with the avatar.

If the avatar does not have access to the parcel containing the prim running this script, this call fails.

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

## Specification

<table>
	<tr>
		<td>**Constant**</td>
		<td>**Value**</td>
		<td>**Description**</td>
	</tr>
	<tr>
		<td>[SIT_OK](/constants/SIT_OK/)</td>
		<td>1</td>
		<td>The agent was seated successfully.</td>
	</tr>
	<tr>
		<td>[SIT_NOT_EXPERIENCE](/constants/SIT_NOT_EXPERIENCE/)</td>
		<td>-1</td>
		<td>The script is not running as part of an experience with a valid experience key or the experience is not allowed at your location.</td>
	</tr>
	<tr>
		<td>[SIT_NO_EXPERIENCE_PERMISSION](/constants/SIT_NO_EXPERIENCE_PERMISSION/)</td>
		<td>-2</td>
		<td>The agent has not granted permission.</td>
	</tr>
	<tr>
		<td>[SIT_NO_SIT_TARGET](/constants/SIT_NO_SIT_TARGET/)</td>
		<td>-3</td>
		<td>Unable to find an open sit target.</td>
	</tr>
	<tr>
		<td>[SIT_INVALID_AGENT](/constants/SIT_INVALID_AGENT/)</td>
		<td>-4</td>
		<td>Unable to find specified agent.</td>
	</tr>
	<tr>
		<td>[SIT_INVALID_LINK](/constants/SIT_INVALID_LINK/)</td>
		<td>-5</td>
		<td>Unable to find specified link or the link constant would return multiple prims.</td>
	</tr>
	<tr>
		<td>[SIT_NO_ACCESS](/constants/SIT_NO_ACCESS/)</td>
		<td>-6</td>
		<td>The avatar does not have access to the parcel that the prim running this script is located in.</td>
	</tr>
	<tr>
		<td>[SIT_INVALID_OBJECT](/constants/SIT_INVALID_OBJECT/)</td>
		<td>-7</td>
		<td>This value is returned if the [llSitOnLink](/functions/llSitOnLink/) is trying to force the user to sit on something that cannot be sat upon (such as an attachment).</td>
	</tr>
</table>

## Caveats

- The [SIT_OK](/constants/SIT_OK/) constant is only present on Lua-enabled sims. On older sims, use it's value of 1 instead

## Examples

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

```lsl collapse={1-9, 15-23}
integer gLinkId = LINK_THIS;

default
{
    touch_start(integer total_number)
    {
        llRequestExperiencePermissions(llDetectedKey(0), "");
    }

    experience_permissions(key agent_id)
    {
        integer sitTest = llSitOnLink(agent_id, gLinkId);
        if (sitTest != 1)
        {
            llInstantMessage(agent_id, "Cannot force agent " + (string)agent_id + " to sit due to reason id: " + (string)sitTest);
        }
    }

    experience_permissions_denied(key agent_id, integer reason)
    {
        llInstantMessage(agent_id, "Denied experience permissions for " + (string)agent_id + " due to reason id: " + (string)reason);
    }
}
```

</details>

## Notes

This function was introduced in conjunction with new [primitive parameter](https://wiki.secondlife.com/wiki/LlSetPrimitiveParams) constants: [PRIM_ALLOW_UNSIT](/constants/PRIM_ALLOW_UNSIT/), [PRIM_SCRIPTED_SITS_ONLY](https://wiki.secondlife.com/wiki/PRIM_SCRIPTED_SITS_ONLY), and [PRIM_SIT_TARGET](/constants/PRIM_SIT_TARGET/).

## Known issues

From the issue templates included by the wiki article:

- BUG-40739 (nf): Redesign llSitOnLink() to use the permissions system

## See also

### Functions

- [llLinkSitTarget](/functions/llLinkSitTarget/)
- [llSitTarget](/functions/llSitTarget/)
- [llSetSitText](/functions/llSetSitText/)
- [llAvatarOnLinkSitTarget](/functions/llAvatarOnLinkSitTarget/)
- [llAvatarOnSitTarget](/functions/llAvatarOnSitTarget/)
- [llUnSit](/functions/llUnSit/)

### Constants

- [PRIM_ALLOW_UNSIT](/constants/PRIM_ALLOW_UNSIT/)
- [PRIM_SCRIPTED_SIT_ONLY](/constants/PRIM_SCRIPTED_SIT_ONLY/)
- [PRIM_SIT_TARGET](/constants/PRIM_SIT_TARGET/)

---

*Source: [LlSitOnLink](https://wiki.secondlife.com/wiki/LlSitOnLink) on the Second Life Wiki. Content from the Second Life Wiki articles LlSitOnLink (revision 1218900, 2026-06-05) and Template:Issues/BUG-40739 (revision 1204762, 2016-10-22), CC BY-SA 3.0.*

---

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