I have this code to change the default chat keycode from /
to Return using ChatInputBarConfiguration.
The bottom code fails however using another button like Z
will work properly. Return
is unsupported? Will it ever receive support?
local TextChatService = game.TextChatService
local ChatInputBarConfiguration = TextChatService:WaitForChild("ChatInputBarConfiguration")
ChatInputBarConfiguration.KeyboardKeyCode = Enum.KeyCode.Return
This works:
local TextChatService = game.TextChatService
local ChatInputBarConfiguration = TextChatService:WaitForChild("ChatInputBarConfiguration")
ChatInputBarConfiguration.KeyboardKeyCode = Enum.KeyCode.Z
Expected behavior
When pressing Enter
focus on Chat should occur to allow player to begin typing.
Edit
I can work around this by making custom Textbox chat to bypass the unsupported using this example script works. Bu I want to use the native roblox chat.
local ContextActionService = game:GetService("ContextActionService")
local ACTION_NAME = "FocusTheTextBox"
local textBox = script.Parent
local function handleAction(actionName, inputState, _inputObject)
if actionName == ACTION_NAME and inputState == Enum.UserInputState.End then
textBox:CaptureFocus()
end
end
ContextActionService:BindAction(ACTION_NAME, handleAction, false, Enum.KeyCode.Return)