Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Dad_Bot 34
7 years ago

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

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

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

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

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

01local currentEquipped = {}
02game:GetService("ReplicatedStorage").EquipTool.OnServerEvent:connect(function(player, slot)
03    local hum = workspace:WaitForChild(player.Name).Humanoid
04    if player:WaitForChild("Backpack"):GetChildren()[slot] then
05        if currentEquipped[player.Name] ~= slot then
06            hum:UnequipTools()
07            hum:EquipTool(player.Backpack:GetChildren()[slot])
08            currentEquipped[player.Name] = slot
09        else
10            hum:UnequipTools()
11            currentEquipped[player.Name] = nil
12        end
13    else
14        hum:UnequipTools()
15        currentEquipped[player.Name] = nil
16    end
17end)
Ad
Log in to vote
0
Answered by 7 years ago
1local StarterGui = game:GetService('StarterGui')
2StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)

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

0
He said without disabling the backpack lol Dragonchao 62 — 7y
0
Ah, my bad. Decimaprism 65 — 7y

Answer this question