# getElementAttachedTo (Shared)

> Tells which element an element is attached to.

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

## Syntax

```lua
element|false getElementAttachedTo(element element)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `element` | `element` | The element to check. |

## Returns

The target element, or `false` if the element is not attached.

## Example

```lua
addCommandHandler("onde", function(player)
    local target = getElementAttachedTo(player)
    if target then
        outputDebugString(getPlayerName(player) .. " is attached to a " .. getElementType(target))
    end
end)
```

## See also

- [attachElements (Shared)](https://wiki.mymp.gg/en/attachElements.md): Hangs one element on another. From then on it follows the target until it is detached.
- [isElementAttached (Shared)](https://wiki.mymp.gg/en/isElementAttached.md): Tells whether an element is attached to another.
- [getAttachedElements (Shared)](https://wiki.mymp.gg/en/getAttachedElements.md): Lists the elements attached directly to an element.
