Garry's Mod Wiki

Player:Flashlight

  Player:Flashlight( boolean isOn )

Description

Enables/Disables the player's flashlight.

Player:CanUseFlashlight must be true in order for the player's flashlight to be changed. GM:PlayerSwitchFlashlight can block this function.

Added in 2025.11.12, the gmod_flashlight attachment is used as a source for the player's flashlight. In thirdperson, the playermodel and weapon worldmodel are checked; in firstperson, the viewmodel is checked. If the attachment isn't found, default engine functionality is used.

The light sprite attached to the playermodel when the flashlight is on will also follow the playermodel's gmod_flashlight attachment if it exists.

Arguments

1 boolean isOn
Turns the flashlight on/off

Example

Turns off and disables the player's flashlight

Entity( 1 ):Flashlight( false ) Entity( 1 ):AllowFlashlight( false )