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

Detecting Return keycode from a mobile device?

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?

3 comments

0

This is a very good question. I'd like to know the same.

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

0

I guess I'll try that

1 answer

✓ Accepted answer

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.

1 comment

0

thx, this will help a lot!

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