I’ve been working on a single text field GUI where the text fields are separated, kind of like an OTP input field.
The GUI consists of 5 text boxes that are connected to the
GuiObject.Changed event. So if any text gets added or removed, the event fires. At the same time I’m checking which one of the 5 is focused by using the
TextBox.Focused event so I can
CaptureFocus() of the next/previous text field.
Now, to the issue. I can not
CaptureFocus() of a previous text field if the current one’s text is empty by pressing backspace, the event doesn’t fire. The event fires only when there’s text in the first place.
There are ways around this issue of course, UserInputService for instance, but then I’d be facing another issue. On Windows/Mac there’s a keyboard property called “Character Repeat”, for example, the longer you hold backspace the faster characters get deleted. But by using UserInputService I’d make my life way more difficult. Also by using while loops, things get out of order, sometimes 2-3 characters get deleted at once and it gets counterintuitive by making the player wait.
TL;DR: Is there a way to get a
GuiObject.Changed event just by pressing backspace on an empty text field?
GIF of my text field GUI: