# getRootElement (Shared)

> Returns the root element, the top of the element tree. It is the same value as the global `root`.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Elements
- **URL**: https://wiki.mymp.gg/en/getRootElement

## Syntax

```lua
element getRootElement()
```

## Returns

The root element.

## Example

```lua
addEventHandler("onClientResourceStart", getRootElement(), function(resource)
    outputDebugString(getResourceName(resource) .. " started")
end)
```

## See also

- [getElementChildren (Shared)](https://wiki.mymp.gg/en/getElementChildren.md): Lists an element's direct children, optionally only those of one type.
- [getElementParent (Shared)](https://wiki.mymp.gg/en/getElementParent.md): Reads an element's parent in the element tree.
- [getResourceRootElement (Shared)](https://wiki.mymp.gg/en/getResourceRootElement.md): Returns a resource's root element, the same as that resource's resourceRoot global.
