Is it possible to make tools have a priority on the toolbar?
If I have tool1, tool2, and tool3, Is there an easy way I can make the player’s toolbar show them in that priority? The player gets the tool at slightly different times.
1 Like
Name your tools in a way that reflects their priority order. For example, name them 1_tool
, 2_tool
, 3_tool
.
Let me know if this script works?
local player = game.Players.LocalPlayer
local backpack = player.Backpack
-- Function to sort tools by name
local function sortTools()
local tools = backpack:GetChildren()
table.sort(tools, function(a, b)
return a.Name < b.Name
end)
-- Reorder tools in backpack
for i, tool in ipairs(tools) do
tool.Parent = backpack
end
end
-- Call sortTools() whenever a new tool is added to the backpack
backpack.ChildAdded:Connect(sortTools)
sortTools() -- Initial sort when player joins
2 Likes