Skip to content

Instantly share code, notes, and snippets.

@ryanlua
Last active November 30, 2025 09:48
Show Gist options
  • Select an option

  • Save ryanlua/42274f0d1347ce5d2c68a570200c1dcb to your computer and use it in GitHub Desktop.

Select an option

Save ryanlua/42274f0d1347ce5d2c68a570200c1dcb to your computer and use it in GitHub Desktop.
Creates a TopbarPlus dropdown that allows you to add Tools and HopperBins to the backpack along with clearing it.
--!strict
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Icon = require(ReplicatedStorage.Packages.topbarplus)
local player = Players.LocalPlayer :: Player
local toolIcon = Icon.new()
toolIcon:setLabel("Backpack Options")
toolIcon:align("Right")
toolIcon:setDropdown({
Icon.new()
:setLabel("Add Tool")
:bindEvent("deselected", function()
local backpack = player:FindFirstChildOfClass("Backpack") :: Backpack
local tool = Instance.new("Tool")
tool.Parent = backpack
end)
:oneClick(),
Icon.new()
:setLabel("Add HopperBin")
:bindEvent("deselected", function()
local backpack = player:FindFirstChildOfClass("Backpack") :: Backpack
local hopperBin = Instance.new("HopperBin")
hopperBin.Parent = backpack
end)
:oneClick(),
Icon.new()
:setLabel("Clear Backpack")
:bindEvent("deselected", function()
local backpack = player:FindFirstChildOfClass("Backpack") :: Backpack
backpack:ClearAllChildren()
end)
:oneClick()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment