Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Detecting Return keycode from a mobile device?

Asked by 7 years ago

I've made a working chat script, but it cant detect when the player hits return on mobile.

Basically what I'm asking is: How to detect when a mobile device presses return on their keyboard for chat?

I've already tried:

InputService.InputBegan:connect(function(Key)
    if Key.KeyCode == Enum.KeyCode.Return then
        --stuff in here
    end
end)

And it didn't work so can someone help me?

0
This is a very good question. I'd like to know the same. User#2146 0 — 7y
1
What you've called "Key" is an InputObject. Try printing out all its properties after line 1 to see what Roblox sends (if anything) when 'return' is pressed. InputObject documentation: http://wiki.roblox.com/index.php?title=API:Class/InputObject chess123mate 5873 — 7y
0
I guess I'll try that GammaShock 32 — 7y

1 answer

Log in to vote
0
Answered by
cabbler 1942 Moderation Voter
7 years ago

The only time you can even get "keyboard" input on mobile is in the context of a textbox. So if the box is single-lined, one trick is to use the even FocusLost ( bool enterPressed, InputObject inputThatCausedFocusLoss ). Otherwise, I'm sure inputbegan works.

0
thx, this will help a lot! GammaShock 32 — 7y
Ad

Answer this question