So, I want to make a chatting system and I already am done with it. But my game is in first-person view so you can’t click the textbox to chat. Is there any way of doing this because it is really annoying and might only work if you have a touch screen…
1 Like
Textboxes have a build in function TextBox:CaptureFocus which will fufill your needs. This article also provides a code snippet to make a chat button.
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.Begin then
textBox:CaptureFocus()
end
end
ContextActionService:BindAction(ACTION_NAME, handleAction, false, Enum.KeyCode.Q)
3 Likes
But also there is no keycode for Enter so how do I do that???
Use Enum.Keycord.Return if you want the Enter key to open focus the chat’s textbox.
1 Like
Oh thanks I forgot that there are more words than just enter.
1 Like