SetCameraTarget
setCameraTarget
Requests that one player's camera follows another connected player.
Syntax
bool setCameraTarget(int playerId, int targetPlayerId)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The connected player identifier. |
targetPlayerId |
int |
yes | The connected player that should become the camera target. |
Returns
Returns true when the validated camera request is accepted and queued; otherwise returns false.
Examples
Temporarily spectate another player:
if setCameraTarget(playerId, targetPlayerId) then
setTimer(resetCamera, 5000, 1, playerId)
end
Notes
- Available only in server-side resource scripts.
- Experimental: this is a narrow target-follow request, not an arbitrary cinematic camera API.
- Call
resetCamerato return control to the player's normal camera.