TAB as a keybind

Hello, I am trying to make a backpack GUI for my game but i want the key bind to be set to TAB but I don’t know how to do that. I have tried typing tab and just pressing it but i don’t know what the actual key bind is called, can someone please help me out.

You could google name of TAB. But I dont know exactly want you want xd, the name of TAB is by the way tabulator key

im trying to make it so it opens a gui when i press tab but i don’t know what to put there for the KeyCode

local hotkey = Enum.KeyCode. -- i want this to be the TAB key

local UIS = game:GetService("UserInputService")
local open = false



UIS.InputBegan:Connect(function(key, gp)
 if key.KeyCode == hotkey then
  if UIS:GetFocusedTextBox() == nil then
   if open == false then
    open = true 
    frame.Visible = open
   elseif open == true then
    open = false
    frame.Visible = open
   end
  end
 end
end)

the Enum for Tab is Enum.KeyCode.Tab

you can find other keycodes here: KeyCode | Documentation - Roblox Creator Hub

1 Like

i tried doing Tab but it didn’t work so thats why i was confused

Are you sure you are hidding the default chat with StarterGui:SetCoreEnabled()? If not, then gp will always be true.

gp will only be true if input is done on gui, and in function connected to the InputBegan event, he didn’t add checks for gp so it shouldnt matter

@peepo12343 try putting prints inside the if statements to see if they run. if the if statements run properly, the problem might be how you define frame

ok, i set the core to enabled and it worked. thanks for helping