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
6 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 6 years ago
Edited 6 years ago

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)
Ad
Log in to vote
0
Answered by 6 years ago
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.

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

Answer this question