Revision Difference
Player:KeyDownLast#515973
<function name="KeyDownLast" parent="Player" type="classfunc">
<description>Gets whether a key was down one tick ago.</description>
<realm>Shared</realm>
<args>
<arg name="key" type="number">The key, see <page>IN</page></arg>
</args>
<rets>
<ret name="" type="boolean">Is key down</ret>
</rets>
</function>
⤶
{{Example⤶
| Description = Prints whenever the first player stopped pressing W last tick⤶
| Code = hook.Add( "Tick", "CheckPlayer1Forward", function()⤶
```⤶
⤶
if ( !Entity( 1 ):KeyDown( IN_FORWARD ) ) and Entity( 1 ):KeyDownLast( IN_FORWARD ) then print( "Ent1 is no longer holding W!") end
```⤶
⤶
end )⤶
}}⤶
<example>⤶
<description>Prints whenever the first player stopped pressing W last tick</description>⤶
<code>⤶
hook.Add( "Tick", "CheckPlayer1Forward", function()⤶
if ( !Entity( 1 ):KeyDown( IN_FORWARD ) ) and Entity( 1 ):KeyDownLast( IN_FORWARD ) then print( "Ent1 is no longer holding W!") end
end )⤶
</code>⤶
⤶
</example>