I’m trying to make a Textbox effect when you hold a key like this (Using the roblox chat as an example):
Only issue is that I need it to be really accurate to the normal, default TextBox. Only issue Is that I don’t know How long each pause is, is mainly the issue. There is 2 pauses, The first pause which is a tad longer, which happens when you first press the kay. Then the second pause which is after every character after the first pause. If that makes sense. Also How can I achieve such a system with holding a key then added X amount of characters .
The text that was being outputted was for a test by using UserInputService. It just was printing out the key that was used and the last key(s) combined in a string. By using Input begin
I would use TextBox.Changed to time the length between changes. You can then use those times how you need if you want to use UserInputService. Otherwise, you could hook the function directly up to TextBox.Changed to get an even more accurate result.
If you’re trying to make a new chat system for your game try using the function focused for the textbox. Here is a part from the roblox documentation for texbox:
Focus State
It is possible to detect and change the focus state of a TextBox:
You can use CaptureFocuswhen a dialogue appears so that the player doesn’t have to click on a TextBox when it becomes available; you can use ContextActionService:BindAction() to bind a certain key to focus a TextBox using this function. When a TextBox comes into focus, the Focusedevent fires.
When the player is done inputting text, the FocusLostevent fires, indicating if the user pressed Enter to submit text along with the InputObject that caused the loss of focus. When using on screen keyboards on mobile and console,ReturnPressedFromOnScreenKeyboard may also fire.
If some more important matter comes up during gameplay, you can ReleaseFocus of the TextBox so that a player’s keyboard input returns to your game
I didn’t ask for any of that? I want to know how to replicate a TextBox functionality mainly when holding a key. Also a lot of your methods won’t work as Roblox prevents you from changing the focus state of custom chats even if that was what I was looking for. As stated in the Roblox docs :
“For security, some limitations are imposed on the TextBox when it is promoted to ChatInputBarConfiguration.TextBox. Lua code will not be able to:
I did something with this very similar, but not with textboxes. It’s essentially a loop, or connection where each event is delayed by x, and every event x is decreased.
Well, you’d have to override the typing system with it. This means you’d have to turn off TextEditable, and catch any keys typed with UIS and edit the textbox manually.
This is actually a very hard task to replicate as you would need to remake the entire Textbox functionality, which includes handling cursorposition, etc.