local UserInputService = game:GetService("UserInputService")
local inventoryGui = game.Players.LocalPlayer.PlayerGui:WaitForChild("ItemInvGui") -- Reference to the inventory GUI
local armorGui = game.Players.LocalPlayer.PlayerGui:WaitForChild("ArmorInvGui") -- Reference to the armor inventory GUI
local eKeyCode = Enum.KeyCode.E
local currentGui = nil -- Variable to store the currently visible inventory GUI
UserInputService.InputBegan:Connect(function(input, isProcessed)
if input.KeyCode == eKeyCode and not isProcessed then
if currentGui then
currentGui.Enabled = false -- Close the currently visible inventory GUI
currentGui = nil -- Reset the currentGui variable
game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
else
if inventoryGui.Enabled then
currentGui = inventoryGui -- Set the currentGui variable to the inventory GUI
elseif armorGui.Enabled then
currentGui = armorGui -- Set the currentGui variable to the armor inventory GUI
end
if currentGui then
currentGui.Enabled = false -- Close the currentGui inventory GUI
currentGui = nil -- Reset the currentGui variable
game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
end
end
end
end)
there is a image attached too. those are the 4 sections' names
Ping me if you know an answer. Thanks alot!