# getElementAttachedTo (Compartilhado)

> Diz em qual elemento um elemento está anexado.

- **Plataforma**: MY Multiplayer (MYMP)
- **Tipo**: Função Lua
- **Lado**: Compartilhado
- **Categoria**: Anexos
- **URL**: https://wiki.mymp.gg/pt/getElementAttachedTo

## Sintaxe

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

## Parâmetros

| Nome | Tipo | Descrição |
| --- | --- | --- |
| `element` | `element` | O elemento a consultar. |

## Retorno

O elemento alvo, ou `false` se o elemento não está anexado.

## Exemplo

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

## Veja também

- [attachElements (Compartilhado)](https://wiki.mymp.gg/pt/attachElements.md): Pendura um elemento em outro. A partir daí ele segue o alvo até ser solto.
- [isElementAttached (Compartilhado)](https://wiki.mymp.gg/pt/isElementAttached.md): Diz se um elemento está anexado a outro.
- [getAttachedElements (Compartilhado)](https://wiki.mymp.gg/pt/getAttachedElements.md): Lista os elementos anexados diretamente a um elemento.
