# getElementComponentPosition (Client)

> Returns the position of a vehicle's or object's component.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Components and bones
- **URL**: https://wiki.mymp.gg/en/getElementComponentPosition

## Syntax

```lua
float, float, float|false getElementComponentPosition(vehicle|object element, string component [, string base = "root"])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `element` | `vehicle\|object` | The vehicle or object. |
| `component` | `string` | The component's name, as `getElementComponents` lists it. |
| `base` | `string` | Relative to what: `"world"`, `"root"` (the element itself) or `"parent"` (the component's parent frame). Case does not matter. *(default: `"root"`)* |

## Returns

Three numbers `x, y, z`, or `false` if the component does not exist.

## Example

```lua
local vehicle = getPedOccupiedVehicle(localPlayer)
if vehicle then
    local x, y, z = getElementComponentPosition(vehicle, "bonnet_dummy", "world")
    if x then
        outputDebugString(("Bonnet at %.1f, %.1f, %.1f"):format(x, y, z))
    end
end
```

### Coming from MTA

The same as MTA's `getVehicleComponentPosition`, but it also works on objects.

## See also

- [setElementComponentPosition (Client)](https://wiki.mymp.gg/en/setElementComponentPosition.md): Moves a vehicle's or object's component. The change applies on this client only.
- [resetElementComponentPosition (Client)](https://wiki.mymp.gg/en/resetElementComponentPosition.md): Puts a vehicle's or object's component back at the model's own position, undoing setElementComponentPosition.
- [getElementComponentRotation (Client)](https://wiki.mymp.gg/en/getElementComponentRotation.md): Returns the rotation of a vehicle's or object's component, in degrees.
- [getElementComponents (Client)](https://wiki.mymp.gg/en/getElementComponents.md): Lists a vehicle's or object's components: the named frames of its model.
