# setElementBoneQuaternion (Client)

> Sets the orientation of a ped's or object's bone relative to its parent bone, as a quaternion. 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/setElementBoneQuaternion

## Syntax

```lua
bool setElementBoneQuaternion(ped|object element, int|string bone, float x, y, z, w)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `element` | `ped\|object` | The ped, player or object. An object needs a model with a skeleton or a node tree. |
| `bone` | `int\|string` | The bone. On a ped: an MTA bone id, a rig bone's tag or its name. On an object: a node's name or a bone's tag. |
| `x, y, z, w` | `float` | The quaternion, as four numbers or one `quat`. |

## Returns

`true` if it was set. `false` if the element is streamed out, the bone has no pose or the ped is in a ragdoll.

A ped's pose and an animated object's pose are rebuilt every frame: change them in `onClientPedsProcessed`, which fires once the frame's poses are built. An object without an animation keeps what was set. Whatever is attached to the bone follows it.

## Example

```lua
addEventHandler("onClientPedsProcessed", root, function()
    setElementBoneQuaternion(localPlayer, 5, 0, 0, 0.259, 0.966)
end)
```

### Coming from MTA

In MTA it works on peds only. Here it also takes objects and rig bones by tag or name.

### Note

Raises an error if the element has no such bone. While the element is streamed out, it returns `false`.

## See also

- [getElementBoneQuaternion (Client)](https://wiki.mymp.gg/en/getElementBoneQuaternion.md): Returns the orientation of a ped's or object's bone relative to its parent bone, as a quaternion.
- [setElementBoneRotation (Client)](https://wiki.mymp.gg/en/setElementBoneRotation.md): Turns a ped's or object's bone relative to its parent bone. The change applies on this client only.
- [onClientPedsProcessed (Client)](https://wiki.mymp.gg/en/onClientPedsProcessed.md): Fired every frame after peds and objects have been animated, before they are presented and drawn.
