Player::taskLookAt
Method to task player to look at another entity. Client-side tasks are synced.
Syntax
```js player.taskLookAt(lookAt, duration, flags, priority); ```
Required Arguments
- lookAt: Entity handle or object
- duration: int
- flags: int
- priority: int
Return value
- Undefined
Example
```js /**
* Function to make local player look at another player
* @param \{number\} targetRemoteId - Remote(server) id of the player to look at
*/
function localPlayerLookAtPlayer(targetRemoteId) {
// Get target player from the pool by his remote id
const target = mp.players.atRemoteId(targetRemoteId);
// If target player is not found, stop
if (!target || target.handle === 0) return;
// Call the method to look at another entity, in this case player
mp.players.local.taskLookAt(target.handle, -1, 2048, 2);
} ```