Hide Inventory without disabling function

I found this post which was most relevant to my problem.

In the solution, I used the sample provided in the solution in my code.

I tried to both implement it and unequipping with this code sample.

local keybinds = {"One","Two","Three","Four"}

userinputservice.InputBegan:Connect(function(input, gameProcessed)
	if gameProcessed then return end
	if table.find(keybinds,input.KeyCode.Name) then
		local toolName = _G.data.equippedWeapons[input.KeyCode.Name]
		if toolName then
			local tool = player.Backpack:FindFirstChild(toolName)
			if tool then
				char.Humanoid:EquipTool(tool)
				--Unequipping is intentionally disabled for my game's purposes, but it's not that hard to do either
			elseif char:FindFirstChild(toolName) then
				tool.Parent = player.Backpack
			end
		end
	end
end)

It did not work. at all.
What is the issue here?

1 Like

I forgot to say that I disabled backpack coregui to hide it.

honestly i have no idea what is wrong here but i just suggest placing prints everywhere and checking where does the code reach which one of the if checks don’t work as expected