Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How would I make a textbox available to type in when a key is pressed?

Asked by 10 years ago

I have no idea how to get started with that. Could someone give me a major hint or point me to a robloxwiki for that?

0
I would love to help but I don't fully understand your problem. Bman8765 270 — 10y
0
Oh, I'm sorry. Like for example, the core chat GUI. When you press the "/" key, it automatically lets you enter in what you want to say. But say I wanted to do that for any other GUI and I have a textbox. If I press a certain key, how could I make it automatically jump to letting you input text? Hope that's more clear. :) Devotional 210 — 10y

1 answer

Log in to vote
1
Answered by 10 years ago

There is a function which focuses on the text box when called, :CaptureFocus(). Here is an example:

local player = script.Parent.Parent.Parent.Parent
local mouse = player:GetMouse()
local textbox = script.Parent

mouse.KeyDown:connect(function(key)
    if key == "/" then--if the key is '/' then
        textbox:CaptureFocus() --User can type
    end
end)

If you are new to keys you can go to this link here : http://wiki.roblox.com/index.php?title=Taking_keyboard_input Which shows how to get keyboard input. Hope i helped!

0
Thank you so much! Devotional 210 — 10y
Ad

Answer this question