# setElementHealth (Shared)

> Sets the health of a ped, player, vehicle or object.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Elements
- **URL**: https://wiki.mymp.gg/en/setElementHealth

## Syntax

```lua
bool setElementHealth(element element, float health)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `element` | `element` | The ped, player, vehicle or object. |
| `health` | `float` | The new health. |

## Returns

`true` if it was set, `false` if the element has no health.

On the server, a value that is not finite is refused, and a ped or player at 0 or below counts as dead.

## Example

```lua
addCommandHandler("heal", function(player)
    setElementHealth(player, 100)
end)
```

## See also

- [getElementHealth (Shared)](https://wiki.mymp.gg/en/getElementHealth.md): Reads the health of a player, ped, vehicle or object.
- [isPedDead (Server)](https://wiki.mymp.gg/en/isPedDead.md): Tells whether a ped or player is dead.
