# setCameraTarget (Client)

> Makes the camera follow a player or ped, as in normal play. It also undoes `setCameraMatrix` and `attachCameraToElement`.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Camera
- **URL**: https://wiki.mymp.gg/en/setCameraTarget

## Syntax

```lua
bool setCameraTarget(player|ped target)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `target` | `player\|ped` | The player or ped. `localPlayer` gives the camera back to the local player. |

## Returns

`true` if the camera now follows the target. `false` if it is neither a player nor a ped, or is not loaded.

## Example

```lua
addCommandHandler("resetcam", function()
    setCameraTarget(localPlayer)
end)
```

## See also

- [getCameraTarget (Client)](https://wiki.mymp.gg/en/getCameraTarget.md): Returns the player or ped the camera is following.
- [setCameraMatrix (Client)](https://wiki.mymp.gg/en/setCameraMatrix.md): Fixes the camera at a point, looking at another, until setCameraTarget gives it back to a ped.
- [attachCameraToElement (Client)](https://wiki.mymp.gg/en/attachCameraToElement.md): Attaches the camera to an element: it follows the element's position and rotation until setCameraTarget gives it back to a ped.
