Player:KeyDown
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
Returns
Example
Prints whenever the first player is holding +forward key (w on QWERTY keyboards).
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!