Hello! Today I ran into an issue where I couldn’t find a way to check if the inventory menu is visible. I was wondering if there was any way to do this. There are functions such as StarterGui:GetCore(“DevConsoleVisible”) to check if the developer console is currently visible but I wasn’t able to find a method for checking if the inventory menu is visible. Any help?
Unfortunately, the CoreScript “BackpackScript” does not actually register a GetCore for the Backpack. Alternatively you could disable the Backpack CoreGuiType, and create a custom Backpack, or modify the existing CoreScript to suit your needs.
You could track whether the inventory is open by checking if the key is pressed, although this isn’t really reliable because it can’t track if the inventory button is pressed on the screen.
local uis = game:GetService("UserInputService")
local invOpen = false
uis.InputBegan:Connect(function(input, processed)
if processed then return end
if input.KeyCode == Enum.KeyCode.Backquote then
if invOpen then
invOpen = false
else
invOpen = true
end
end
end)
game.Players.LocalPlayer.CharacterRemoving:Connect(function(char)
invOpen = false -- Inventory closes when a character respawns
end)
You’d likely be better off making your own inventory system if you still want to accomplish this.