Garry's Mod Wiki

Player:GetViewEntity

  Entity Player:GetViewEntity()

Description

Returns the entity the player is using to see from (such as the player itself, the camera, or another entity).

This function will return a [NULL Entity] until Player:SetViewEntity has been used

Returns

1 Entity
The entity the player is using to see from

Example

Will print what entity the first player uses to look through.

Output: Player [1][ExamplePlayer]