Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I cant use Enum.KeyCode?

How to use KeyCode? I wanted to make a script when you press E the text on the GUI changes

4 comments

0

You suck

0

no u

0

Hey, just asking if you know that Enum.KeyCode is for controller support, not for keyboard support. Also please don't post requests. -FrumosUniverse

0

umm then what do i use?

1 answer

✓ Accepted answer

Do not listen to superawesome113. He is wrong. KeyCode is an Enum specifically designed for keyboards and keyboard input. (Controllers also have KeyCodes, but their KeyCodes are of less priority than keyboard KeyCodes.)

KeyCode would usually be used with the UserInputService, a client side only service that is used to receive input (hence its name). For detecting the letter E, that would be Enum.KeyCode.E.

For using KeyCode, the UserInputService's InputBegan event passes two parameters for this, the first being the input received. You can check if that input was keyboard input using the keyboard's UserInputType Enum. Then you can use input.KeyCode to find what KeyCode was received.

That's basically how you use KeyCode.

3 comments

0

Can i get an example?

0

if input.KeyCode == Enum.KeyCode.E then

0

thx

This discussion is preserved as it was. New answers, comments, and votes are closed.