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

How to edit text box after pressing enter?

Asked by
jwklong 32
4 years ago

I am making a game and it uses text boxes, but I want to be able to edit the text boxes after pressing enter/clicking off the text box but I can't, I have looked at the API reference but nothing is mentioning this, please help!

0
go to your explorer starter gui then text box then text and change it Jo1nts 134 — 4y
0
lemme try jwklong 32 — 4y
0
didn't work jwklong 32 — 4y

1 answer

Log in to vote
1
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
4 years ago

I've never attempted this before, but I can imagine some uses! After some quick thought, this should solve your predicament:

local TextBox = script.Parent


TextBox.FocusLost:Connect(function(EnterPressed)
    if not (EnterPressed) then return end
    ---------------
    TextBox:CaptureFocus()
end)
0
When I press enter, the text resets but i can still type inside of the box and clicking outside of the text box and clicking on it resets the text. jwklong 32 — 4y
0
That's due to the ClearTextOnFocus boolean. Toggle it off; if you're trying to make a multi-line TextBox, there is already a built-in option to enable that feature within the TextBox's properties. Ziffixture 6913 — 4y
0
Thanks! jwklong 32 — 4y
Ad

Answer this question