We use cookies on this site to enhance your user experience
Collapse Sidebar


The GetKeysPressed function returns a table of InputObject|InputObjects, whose Enum/KeyCode|Enum.KeyCodes are currently being pressed.

It can be used to retrieve a list of all pressed KeyCodes, which can then be iterated through using a for loop to determine which specific keys are pressed.

If you want to check if a specific key is pressed instead, you can use the UserInputService/IsKeyDown function.

Since UserInputService only runs client-side, this function will only work when used in a LocalScript.


Return Type Summary

An array of InputObject|InputObjects for the keys currently pressed

Code Samples


This example returns an array of the KeyCodes of the keys currently pressed by the user, or an empty array if there are no pressed keys. It then prints the KeyCodes of the pressed keys.