I have a text box in my game that users are able to type in. Desktop users are able to create a new line in this text box by simply pressing the enter key, however on mobile pressing the enter key on their keyboards just makes them stop typing in the text box.
Is there a way to stop this and have the enter key on mobile also create a new line? Mobile users have a “Keyboard down” button anyway (on Apple Devices anyway, not sure about androids) or can just tap outside the text box.
Haven’t tested it on mobile - try this as a local script & parent it to the textbox.
if ClearTextOnFocus is false
script.Parent.FocusLost:Connect(function(enter)
if enter then
script.Parent.Text ..= '\n'
script.Parent:CaptureFocus()
end
end)
if ClearTextOnFocus is true
script.Parent.FocusLost:Connect(function(enter)
if enter then
local input = script.Parent.Text
script.Parent:CaptureFocus()
script.Parent.Text = input..'\n'
script.Parent.CursorPosition = script.Parent.Text:len()+1
end
end)