Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I hide the backpack inventory slots without disabling the backpack?

Hi, I'm trying to make my own custom weapon slots similar to the regular backpack. However, whenever weapons are picked up it just shows the classic backpack lots popping up. How would I hide those inventory slots without disabling the backpack completely? I disabled it but then I couldn't use tools anymore.

2 answers

✓ Accepted answer

You will have to set up a Key Bind to the number keys and then fire a RemoteEvent with the key number.

-- This part is pseudo code... I dont feel like creating working client code.
function OnKeyPress(key)
	if key == number then
		game:GetService("ReplicatedStorage").EquipTool:FireServer(number)
	end
end

On the server side you can handle it kind of like this:

local currentEquipped = {}
game:GetService("ReplicatedStorage").EquipTool.OnServerEvent:connect(function(player, slot)
	local hum = workspace:WaitForChild(player.Name).Humanoid
	if player:WaitForChild("Backpack"):GetChildren()[slot] then
		if currentEquipped[player.Name] ~= slot then
			hum:UnequipTools()
			hum:EquipTool(player.Backpack:GetChildren()[slot])
			currentEquipped[player.Name] = slot
		else
			hum:UnequipTools()
			currentEquipped[player.Name] = nil
		end
	else
		hum:UnequipTools()
		currentEquipped[player.Name] = nil
	end
end)
local StarterGui = game:GetService('StarterGui')
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)

However, I have been able to get this to work at all with FE.

2 comments

0

He said without disabling the backpack lol

0

Ah, my bad.

This discussion is preserved as it was. New answers, comments, and votes are closed.