# getElementAttachedTo (Compartido)

> Dice de qué elemento cuelga un elemento.

- **Plataforma**: MY Multiplayer (MYMP)
- **Tipo**: Función Lua
- **Lado**: Compartido
- **Categoría**: Adjuntos
- **URL**: https://wiki.mymp.gg/es/getElementAttachedTo

## Sintaxis

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

## Parámetros

| Nombre | Tipo | Descripción |
| --- | --- | --- |
| `element` | `element` | El elemento que se consulta. |

## Retorno

El elemento objetivo, o `false` si el elemento no está adjunto.

## Ejemplo

```lua
addCommandHandler("onde", function(player)
    local target = getElementAttachedTo(player)
    if target then
        outputDebugString(getPlayerName(player) .. " está unido a: " .. getElementType(target))
    end
end)
```

## Ver también

- [attachElements (Compartido)](https://wiki.mymp.gg/es/attachElements.md): Cuelga un elemento de otro. A partir de ahí sigue al objetivo hasta que se suelte.
- [isElementAttached (Compartido)](https://wiki.mymp.gg/es/isElementAttached.md): Dice si un elemento está adjunto a otro.
- [getAttachedElements (Compartido)](https://wiki.mymp.gg/es/getAttachedElements.md): Lista los elementos adjuntos directamente a un elemento.
