Hello, I’m making this chat module and I want it so when they press “/” it puts them in typing mode. How do I “force” the player to go into typing mode on a textbox just like roblox’s chat box
2 Likes
You’d call TextBox:CaptureFocus on the textbox. There are already a lot of resources available on this topic, please use them.
https://create.roblox.com/docs/reference/engine/classes/TextBox#CaptureFocus
https://create.roblox.com/docs/reference/engine/classes/ContextActionService#BindAction
Okay so I found this solution:
local ContextActionService = game:GetService("ContextActionService")
local ACTION_NAME = "FocusTheTextBox"
local function handleAction(actionName, inputState, _inputObject)
if actionName == ACTION_NAME and inputState == Enum.UserInputState.Begin then
Msg:CaptureFocus()
end
end
ContextActionService:BindAction(ACTION_NAME, handleAction, true, Enum.KeyCode.Slash)
However it adds this “/” in the textbox which is annoying…
and also @cody I did go to my other sources and I was typing this message before you replied to my response
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.