-
I want my GUI to be “Visible” when I press “i” on my keyboard.
-
The GUI isn’t showing up when I press “i”, error isn’t showing up in the output logs or F9.
-
I have tried using KeyDown, and other methods, and even searched on YouTube, but to no avail.
Here is my variables
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DropItem = ReplicatedStorage:WaitForChild("DropItem")
local UserInputService = game:GetService("UserInputService")
wait(3)
local player = game.Players.LocalPlayer
local Inventory = player.Inventory
local MainGui = script.Parent
local InventoryGui = MainGui.InventoryGui
local InventoryImage = MainGui.InventoryImage
Code with issues
UserInputService.InputBegan:Connect(function(I, IsTyping)
if IsTyping then return end
local Keypressed = I.KeyCode
if Keypressed == Enum.KeyCode.I then
InventoryGui.Visible = true
InventoryImage.Visible = true
end
end)
UserInputService.InputEnded:Connect(function(I, IsTyping)
if IsTyping then return end
local Keypressed = I.KeyCode
if Keypressed == Enum.KeyCode.I then
InventoryGui.Visible = false
InventoryImage.Visible = false
end
end)
this is apart of a larger inventory script, if necessary ill post it in the comments.
Thank you for your time!