How do you rearrange the Roblox Toolbar using script?

  1. What do I want to achieve?
    I want the Roblox CoreGui toolbar to automatically fill in empty slots as tools are removed from the inventory.

  2. What is the issue?
    Toolbar Problem Gif

  • The Dull Sword is placed at slot 6. How do I make it be placed at slot 3 when all the Deer Meats are removed?
  • Is there a way to change the Roblox’s toolbar the same way you can override the Roblox’s camera module?
  • (Not making a completely custom toolbar, I still need most of the functionality of Roblox’s toolbar)
  1. What solutions have I tried so far?
    image

tl;dr

  • I’m lazy to rearrange the toolbar by mouse everytime some tool gets removed. How do I automate this with script?
2 Likes

There is no way to directly rearrange the default backpack unless you make your own custom backpack.

However, when inserting tools into the backpack, they will fill in-order of available slots. So you could try removing all the player’s tools first, then inserting them back in the toolbar in the order you desire.

(Note: There could be a way to do this by directly referencing the Backpack CoreModule, so someone correct me if I am wrong about this)

3 Likes

Try checking for
Player.BackPack.ChildRemoved(Obj)
then check if the Obj is in Character if not then it destroys all the tools in backpack and re-clones them it

1 Like

I managed to find a hacky solution which is by adding a wait() before the loop begins in my current code.
image

  • (I added a task.wait() before the loop begins, it fixed the “ghost tool” issue)

Where is this Backpack CoreModule placed? I might want to have a look

1 Like

Nvm,

When I went to look, the Backpack script is not actually included in the PlayerModule, so it is most likely situated in the roblox CoreGui code, which you cannot access.

So yeah the only solution for you would be to create your own Backpack, or to parent the tools in the order you want them.

1 Like