When detecting keyboard inputs i usually use scripts similar to the small example below:
function PressQ(key) if key == "q" then... end mouse.KeyDown:connect(PressQ)
but I'm wondering what I should replace the "q" on the second line with to detect the down arrow being pressed? I've only ever used letters...
Thank you for your time! :)
KeyDown is deprecated and will no longer work, we now have to use userinputservice.
(Userinputservice is client only!)
local UserInputService = game:GetService('UserInputService') function onInputBegan(input,gameProcessed) if input.KeyCode == Enum.KeyCode.Up then -- Up arrow end end UserInputService.InputBegan:connect(onInputBegan)
You can see I use Enum for the keycode, you can find the keycodes here
But these are the ones you need
Enum.KeyCode.Up --> Up Enum.KeyCode.Down --> Down Enum.KeyCode.Left --> Left Enum.KeyCode.Right --> Right
To do the normal stuff (letters) you can simply do this
Enum.KeyCode.A --> A Enum.KeyCode.B --> B Enum.KeyCode.C --> C
There are more things you can do with it, but these are the things you need.
If you have a question, just ask :)