# llGetRootPosition

*LSL function*

```lsl
vector vector llGetRootPosition();
```

- Returns: `vector`
- Energy: 10

Returns a vector representing the position (in region coordinates) of the root prim of the linkset containing the script.

Returns a [vector](https://wiki.secondlife.com/wiki/vector) that is the [region](https://wiki.secondlife.com/wiki/Viewer_coordinate_frames#region) position of the root object of the object script is attached to

```lsl title="How to use" frame="terminal"
vector result = llGetRootPosition();
```

## Examples

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

```lsl
default{
  touch_start( integer vIntTouched ){
    string vStrMessage = "The prim with this script is ";
    if (llGetPos() != llGetRootPosition()){
      vStrMessage += "NOT ";
    }
    llSay( PUBLIC_CHANNEL, vStrMessage + "centered on the root prim." );
  }
}
```

</details>

## Helper functions

```lsl
//-- there is no llSetLocalPos, this adds the functionality
//-- to match llGetLocalPos() in a child prim
fSetLocalPos( vector vPosOffset ){
  llSetPos( llGetRootPosition() + vPosOffset );
}
//-- this will move a root prim by the offset, or set the
//-- position of a child prim relative to the root.
```

## See also

### Functions

- [llGetLocalPos](/functions/llGetLocalPos/) — Gets the child prims position relative to the root
- [llGetPos](/functions/llGetPos/) — Gets the prims global position
- [llSetPos](/functions/llSetPos/) — Sets the prims global position

---

*Source: [LlGetRootPosition](https://wiki.secondlife.com/wiki/LlGetRootPosition) on the Second Life Wiki. Content from the Second Life Wiki article LlGetRootPosition (revision 1194250, 2015-01-22), CC BY-SA 3.0.*

---

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