Garry's Mod Wiki

Revision Difference

Player:KeyReleased#527138

<function name="KeyReleased" parent="Player" type="classfunc"> <description>Gets whether a key was just released this tick</description> <realm>Shared</realm> <args> <arg name="key" type="number">The key, see <page>Enums/IN</page></arg> </args> <rets> <ret name="" type="boolean">Was released or not</ret> </rets> </function> <example> <description>Prints whenever the first player first stops pressing W</description> <code> hook.Add( "Tick", "CheckPlayer1Forward", function() if Entity( 1 ):KeyReleased( IN_FORWARD ) then print("Ent1 just stopped moving forward!") end⤶ end) if Entity( 1 ):KeyReleased( IN_FORWARD ) then⤶ print( "Player1 just stopped moving forward!" ) end⤶ end )⤶ </code> </example>