# touch_end

*LSL event*

```lsl
touch_end(integer num_detected)
```

- `integer num_detected`: Total number of touching agents detected (usable with llDetected* functions).

Triggered when an avatar stops touching the object. Passes num_detected, representing the number of touching agents.

Triggered when agent stops clicking on task

```lsl title="How to use" frame="terminal"
touch_end(integer num_detected)
{

}
```

## Caveats

- If a prim [face](https://wiki.secondlife.com/wiki/Face) has [Shared Media](https://wiki.secondlife.com/wiki/Navigating_Shared_Media) enabled and the avatar's viewer supports this feature, LSL scripts will not detect touches on that face. Touches from older clients will be detected.
- Rigged mesh attachments do not support touch events, this is because you can steer your avatar/camera by click dragging your avatar body which is what the rigged mesh replaces. The only way to get a touch event on a rigged mesh attachment is via the right click context menu and clicking the "Touch" button.

## Examples

<details open>
<summary>You can use index 0 through (**num_detected**-1) with the various llDetected... functions to handle simultaneous touches at once.</summary>

For most purposes, it's usually enough to handle just with the first toucher e.g. [llDetectedKey](/functions/llDetectedKey/)(0). It is rare (but not impossible) for **num_detected** to be greater than 1.

```lsl
default
{
    touch_start(integer num_detected)
    {
        llResetTime();
    }

    touch_end(integer num_detected)
    {
        llInstantMessage(llDetectedKey(0), "You held the mouse button down for " + (string) llGetTime() + " seconds");
    }
}
```

</details>

<details>
<summary>This next example demonstrates detecting when the owner of the object clicks-and-holds on the object for 1 second in order perhaps to access a management menu or similar, Normal brief clicks are distinguished.</summary>

```lsl collapse={1-5}
default
{
    touch_start(integer num_detected)
    {
        llResetTime(); // Set llGetTime to 0
    }

    touch_end(integer num_detected)
    {
        // Check how much time elapsed since touch_start
        if (llGetTime() <= 1.0)
        {
            // The user did a normal quick click on the object
            // Execute actions for normal clicks...
        }
        else
        {
            // The owner has touched this object for longer than 1 second
            // Execute some special feature such as issuing a management dialog...
        }
    }
}
```

</details>

## See also

### Functions

- [llPassTouches](/functions/llPassTouches/)

### Events

- [touch_start](/events/touch_start/)
- [touch](/events/touch/)

---

*Source: [Touch end](https://wiki.secondlife.com/wiki/Touch_end) on the Second Life Wiki. Content from the Second Life Wiki article Touch end (revision 1218823, 2026-04-30), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/events/touch_end/
