Similar to the fake chat, you can achieve most of this, by doing:
View code
-- LOCAL
local player = game:GetService("Players").LocalPlayer
local playerGui = player.PlayerGui
local gui = playerGui:WaitForChild("TestGUIs")
local replicatedStorage = game:GetService("ReplicatedStorage")
local starterGui = game:GetService("StarterGui")
local topbarPlus = replicatedStorage:WaitForChild("HDAdmin"):WaitForChild("Topbar+")
local iconController = require(topbarPlus.IconController)
-- CREATE ICONS
-- Fake Chat
local icon = iconController:createFakeChat()
icon:notify()
-- Fake backpack
local icon = iconController:createIcon("_Inventory", nil, 1)
icon:setToggleFunction(function()
local isSelected = icon.toggleStatus == "selected"
-- Toggle the backpack on/off here
end)
local inventoryTheme = {
image = {
selected = {
Image = "rbxasset://textures/ui/TopBar/inventoryOn.png"
},
deselected = {
Image = "rbxasset://textures/ui/TopBar/inventoryOff.png"
}
}
}
icon:setTheme(inventoryTheme)
icon:setImageSize(36)
starterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
However, I can’t find any API to toggle the backpack/inventory itself, leaving the only options to fork the core gui or create your own custom.
For example, for the fake chat, I do:
local chatMainModule = players.LocalPlayer.PlayerScripts:WaitForChild("ChatScript").ChatMain
local chatMain = require(chatMainModule)
icon:setToggleFunction(function()
local visibility = icon.toggleStatus == "selected"
chatMain.CoreGuiEnabled:fire(visibility)
chatMain:SetVisible(visibility)
end)
Unfortunately, there doesn’t appear to be a method to do this for the backpack. If anyone does find one, please do let me know and I’ll update the Topbar+ examples.