IsInputKeyDown: Difference between revisions

From Onset Developer Wiki
Created page with "{{Info|Function|Client|1.4.2}} {{FuncDescription|Check if a key is currently pressed.}} {{FuncSyntax|IsInputKeyDown(key)}} {{FuncParameters}} {{FuncParam|key|The key to che..."
 
No edit summary
 
Line 14: Line 14:
AddEvent("OnGameTick", function()
AddEvent("OnGameTick", function()
if IsInputKeyDown("Hyphen") then
if IsInputKeyDown("Hyphen") then
                print("You are holding down the "-" key.")
print("You are holding down the "-" key.")
end
end
end)
end)

Latest revision as of 18:19, 21 January 2021

IsInputKeyDown

Type: Function
Context: Client
Introduced: v1.4.2

Description

Check if a key is currently pressed.

Syntax

IsInputKeyDown(key)

Parameters

  • key
    The key to check.

Return Value

  • Returns true if it is pressed, false otherwise

Example

AddEvent("OnGameTick", function()
	if IsInputKeyDown("Hyphen") then
		print("You are holding down the "-" key.")
	end
end)

See also