Hey developers!
How can I detect when a player presses enter. This is probably a really dumb question, but I haven’t seen something like “Enter” in the Enum.KeyCode
list. Any help would be appreciated!
Have a nice day!
Hey developers!
How can I detect when a player presses enter. This is probably a really dumb question, but I haven’t seen something like “Enter” in the Enum.KeyCode
list. Any help would be appreciated!
Have a nice day!
Is “E” “Enter”? “E” is just the key E right?
Also:
If I’m not mistaken the KeyCode for enter is Return
, so Enum.KeyCode.Return
. Although I could be wrong, so it’s best you test it out by making a simple InputBegan event to print the KeyCode fo what you pressed and see what pressing enter gives
but this is how you do it with enter:
local uis = game:GetService("UserInputService")
uis.In:connect(function(input)
if input.KeyCode == Enum.KeyCode.KeyPadEnter then
--your output here
end
end)
Ok! Trying that right away! I’ll let you know if I got anything.
It’s not in the Enum.KeyCode
list, go check for yourself.
That’s for the KeyPad, I’m pretty sure OP is referring to pressing Enter on their keyboard, not the keypad
@iamajust Try this out as a test to see if Return is actually for enter
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input,gpe)
if gpe then
return
end
print(input.KeyCode)
if input.KeyCode == Enum.KeyCode.Return then
print("Enter Pressed")
end
end
If it isn’t, it’ll print out the correct KeyCode for it
I know, it’s not what I want though. (Also it doesn’t even seem to be working with my keypad.)
Enum.KeyCode.Return
seems to be the keycode for “Enter”. Thank you all for helping!
local UserInputService = game:GetService('UserInputService')
UserInputService.InputBegan:Connect(function(input, talking)
if talking then return end
if input.KeyCode == Enum.KeyCode.Return then
-- user pressed enter
end
end)