The GetKeysPressed function returns a table of
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 only runs client-side, this function will only work when used in a
An array of
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.