# llDerezObject

*LSL function*

```lsl
integer integer llDerezObject(key id, integer flags);
```

- `key id`: UUID of the object in the region to derez.
- `integer flags`: Derez behavior flags matching DEREZ_* constants.

- Returns: `integer`
- Energy: 10

Derezzes (deletes or returns) a targeted object in the region previously rezzed by a script in this linkset, returning TRUE on success or FALSE on failure.

Derezzes an object previously rezzed from within the object containing the script.

Returns an [integer](https://wiki.secondlife.com/wiki/integer) which is [TRUE](/constants/TRUE/) for success or [FALSE](/constants/FALSE/) for failure.

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

## Specification

Deletes, or marks temp, an object that was previously rezzed by this script. The object's root prim must have been previously rezzed from a script within this object.

If the object is successfully deleted this function returns [TRUE](/constants/TRUE/), if it fails for any reason it returns [FALSE](/constants/FALSE/).

| Constant | Value | Description |
| --- | --- | --- |
| [DEREZ_DIE](/constants/DEREZ_DIE/) | 0 | Immediately delete the object. |
| [DEREZ_MAKE_TEMP](/constants/DEREZ_MAKE_TEMP/) | 1 | Mark the object as temporary so that the simulator will remove the object at a later time. |
| [DEREZ_TO_INVENTORY](/constants/DEREZ_TO_INVENTORY/) | 2 | Returns the targeted object to derezzer's inventory and saves its current state. |

## Caveats

- The targeted object's rezzer must be the same as the object hosting this script
- The target must not be an attachment
- The target must be copyable
- The target's owner must be the same as the script's owner.
- When marking an object as temporary, the object must not contribute to the navmesh.
- When using [DEREZ_TO_INVENTORY](/constants/DEREZ_TO_INVENTORY/) there are a few other restrictions:
- The derezzer must not be an attachment.
- The derezzer must be modifiable.
- The object in the derezzer's inventory must still exist.
- The object in the derezzer's inventory must not be a coalesced object.

---

*Source: [LlDerezObject](https://wiki.secondlife.com/wiki/LlDerezObject) on the Second Life Wiki. Content from the Second Life Wiki article LlDerezObject (revision 1218192, 2025-04-22), CC BY-SA 3.0.*

---

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