When TextBox is focused through UserInputService it includes the input with my string

I’m trying to make a custom chat system, and the process works almost flawlessly. One small issue, I use UserInputService to focus on the TextBox using the KeyCode Slash, and when a TextBox is focused using UserInputService the beginning of the string includes the focus input. Here’s an example:
image
image
It’s a little hard to see, but after focusing and my scripts make sure the placeholder text is empty, this slash still makes its way there. Does anyone know how to not include it?

This will happen if you do all the process in one frame, you should add a wait before focusing the TextBox and make sure you focus the TextBox when the key is released.

I was thinking of doing that, but I’m not sure what would happen if a hypothetical lag spike caused the server to ignore waiting or make the wait way too long, causing even more problems

Unless you want to clear your text after opening the chat then I think that’s your only option

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.