# getResourceDynamicElementRoot (Shared)

> Returns the element under which the elements the resource creates by script are placed. It is a child of the resource's element and is called `dynamic`.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Resources and modules
- **URL**: https://wiki.mymp.gg/en/getResourceDynamicElementRoot

## Syntax

```lua
element|false getResourceDynamicElementRoot([resource|string resource = getThisResource()])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `resource` | `resource\|string` | The resource, or its name. Without it, the calling resource. *(default: `getThisResource()`)* |

## Returns

The element, or `false` if the resource is not running.

## Example

```lua
local dynamic = getResourceDynamicElementRoot()
for _, child in ipairs(getElementChildren(dynamic)) do
    outputDebugString(getElementType(child))
end
```

## See also

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