# setElementComponentPosition (Client)

> Moves a vehicle's or object's component. The change applies on this client only.

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

## Syntax

```lua
bool setElementComponentPosition(vehicle|object element, string component, float x, y, z [, string base = "root"])
```

## Parameters

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

## Returns

`true` if it was moved, `false` if the component does not exist.

The position is kept while the element exists, and comes back when it streams in again. Whatever is attached to the component follows it.

## Example

```lua
local vehicle = getPedOccupiedVehicle(localPlayer)
if vehicle then
    local x, y, z = getElementComponentPosition(vehicle, "bonnet_dummy")
    setElementComponentPosition(vehicle, "bonnet_dummy", x, y, z + 0.3)
end
```

### Coming from MTA

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

## See also

- [getElementComponentPosition (Client)](https://wiki.mymp.gg/en/getElementComponentPosition.md): Returns the position of a vehicle's or object's component.
- [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.
- [setElementComponentRotation (Client)](https://wiki.mymp.gg/en/setElementComponentRotation.md): Turns a vehicle's or object's component. The change applies on this client only.
