What do you want to achieve? Keep it simple and clear!
I want to make a custom chat system.
What is the issue? Include screenshots / videos if possible!
I want the player to focus the textbox (that is connected to textchatservice) when he presses a keyboard button
What solutions have you tried so far?
This is my current script but I can’t force the player to focus on a textbox reserved to textchatservice.
game.TextChatService.ChatInputBarConfiguration.TextBox = script.Parent
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == TextChatSerice.ChatInputBarConfiguration.KeyboardKeyCode then
script.Parent:CaptureFocus()
end
end)
Another question:
How do I detect if the player has the chat bar opened? By opened I mean this
local TextChatService = game:GetService("TextChatService")
if TextChatService.ChatInputBarConfiguration.IsFocused then
print("player is focused on the chat bar")
end
Note that:
TextChatService.ChatInputBarConfiguration.IsFocused is ReadOnly & is a Bool. This means you can’t set it yourself and use it as a comparison, like the above code.
This is a local script
Roblox also provides a code example in the docs using the ChangedSignal function, which might better suit another use case.