I have made it so that when you press “I” it opens the gui(even copied from user input service page)
It works with probably any button(since i tested it on button R), but it somehow doesnt work with button I
.
I think that button I
is reserved by core script, and if so, please tell me how to avoid that(the game is locked to first person).
Here’s the script:
local inputService = game:GetService("UserInputService")
local db = false
local selecTab = game.Players.LocalPlayer.PlayerGui.Inventory.Menus.SelectionTab
local itemTab = game.Players.LocalPlayer.PlayerGui.Inventory.Menus.ItemTab
local originPos = selecTab.openedornah
local function getKey(input, Processed)
print("function ran")
if not Processed then
if (inputService:GetFocusedTextBox()) then
print("player typed 'i' when chatting in chat bar")
return; -- player's not chatting
end
if input.KeyCode == Enum.KeyCode.I then
print("got key finally")
if db == false and originPos.Value == false then
print("executing the script")
db = true
originPos.Value = true
itemTab:TweenPosition(UDim2.new(0.572, 0,0.226, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.7)
selecTab.badges.TextLabel.Visible = false
selecTab.inventory.TextLabel.Visible = false
selecTab.settings.TextLabel.Visible = false
wait(2)
db = false
elseif originPos.Value == true then
print("got key finally")
db = true
originPos.Value = false
itemTab:TweenPosition(UDim2.new(1, 0,0.226, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.7)
selecTab.badges.TextLabel.Visible = true
selecTab.inventory.TextLabel.Visible = true
selecTab.settings.TextLabel.Visible = true
wait(2)
db = false
end
end
end
end
inputService.InputBegan:connect(getKey)