How do I make typing a letter look like you pressed Enter in the text box?

With this I mean that when writing a letter, make as if you had pressed enter, so you stop using the textbox when writing a letter in the textbox, this to avoid bugs

local keyText = ""

local KeyMenu = script.Parent.MenuKey

KeyMenu:GetPropertyChangedSignal("Text"):Connect(function()
local text = KeyMenu.Text:upper()
KeyMenu.Text = text:sub(1, 1)
keyText = text
local MenuKey = game.Players.LocalPlayer:WaitForChild("Keys"):WaitForChild("MenuKey")
MenuKey.Value = keyText:sub(1, 1)
end)

I don’t really get what you mean. Do you mean something like exit text box on enter, or make another line?

well, I mean that when I write a letter, it will not automatically let me write another letter, and when I click on the text box, I can change the letter again

You could put something in your code, to check if the length of the text is 1, then make the TextBox’s TextEditable property false until clicked.

I’m assuming you’re using TextBoxes.

I don’t know what you mean by that but I set TextEditable to false and it won’t let me write anymore

I don’t really get what you’re saying… sorry I can’t help you out on this.

do you mean so when someone types some text and press enter then it makes it so they cant edit it any more? just detect when a player presses enter and set TextEditable to false

Well, I don’t speak English, I speak Spanish and I have a hard time writing in English, well what I want is that when I write a letter I stop writing and have to click on the text box again to write.

Would Textbox:ReleaseFocus() be what you’re looking for?

1 Like