Hello, good morning, I hope you are all well, I would like to know if you can help me with something I want to do, which is to change the key to open the chat “/” by the enter key. I have seen that in many games the keys to open the chat change, so I would like to implement this in my game, if you know how I can do it, I really appreciate the help.
The default chat does not have any configuration options for the developers, so there is no direct way of doing it. However, the chat gui is just another gui; it gets parented to PlayerGui and it is comprised of normal gui elements; therefore, we can use a “hacky” method to bind another key.
Using UserInputService and the CaptureFocus function of the text boxes, we can bind more keys. (It is important to note that the chat will still be able to be opened by the “/” key) I’ve prepared an example for you, which will enable the chatbox once you press “Enter” on your keyboard.
The following should go in a local script, and be placed under “StarterGui”:
local UIS = game:GetService("UserInputService") local Chat = script.Parent:WaitForChild("Chat", 60) --Hacky solutions always ask for long directions ;) local Box = Chat:WaitForChild("Frame"):WaitForChild("ChatBarParentFrame"):WaitForChild("Frame"):WaitForChild("BoxFrame"):WaitForChild("Frame"):WaitForChild("ChatBar") UIS.InputBegan:Connect(function(Key, GP) if not GP and Key.KeyCode == Enum.KeyCode.Return then Box:CaptureFocus() end end)
Important note: A minor update on the chat may cause this system to break. I recommend frequent maintenance, if possible.
SIDE EFFECT: This will also allow the users to send utterly empty messages to the chat! This happens only for the “Enter” key, so I suggest using another one.
Thanks it works perfect for me!!
This doesn’t work anymore, any other ideas?