Garry's Mod Wiki

Player:KeyDown

boolean Player:KeyDown( number key )

Description

Gets whether a key is down. This is not networked to other players, meaning only the local client can see the keys they are pressing.

Arguments

1 number key
The key, see Enums/IN

Returns

1 boolean
isDown

Example

Prints whenever the first player is holding forward key

hook.Add("Tick", "KeyDown_Test", function() if (Entity(1):KeyDown(IN_FORWARD)) then print("Player is pressing forward!") end end)
Output: Player is pressing forward! Player is pressing forward! Player is pressing forward! Player is pressing forward!

Page Links


Special Pages


Wikis

?

Render Time: 25ms

DB GetPage 3
Generate Html 4
SaveChanges (1) 8
Render Body 0
Render Sidebar 7