Ways to find what number tools are on?

image

Using the image above, would there be a way to prove that “Tool” is binded to the key, 1 through scripting. Would there also be a way to rearrange which tools are binded to which?

You can rename the the tool like this?
1-sword
2-gun

But then Players would be able to see the numbers like so:
image

You can change the name of tool when the player joins?
1-sword.Name = “sword”

That would mean if I add another tool, I wouldn’t be able to identify its KeyBind

You can just assign it to the new one?

Ok so I’ve actually just tried your method and take a look:
image

It doesn’t seem like the numbers decide where each tool is placed

player.Backpack:GetChildren()[1]

Replace 1 with the number of the slot. This won’t always be accurate though, especially if the player moves things around themselves. May I ask why you’re wanting to know what’s in a given slot? There are likely better methods, depending on what your goal is.

Though the best solution by far, regardless of the goal, would be to create a custom toolbar system yourself.

1 Like

My goal is to create a custom toolbar. I was trying to identify what tools are allocated to what slot so the GUI can suit the desired loadout.

I did try to find tutorials on how to do so but couldn’t find any.

Well you don’t need to do anything like that. There is no actual order to anything, just whichever order they happen to load into first. Just use your own tables for the toolbar and backpack. I won’t explain it step-by-step, but Backpack:GetChildren() will give to a table of all items in their backpack (which includes the toolbar, because that’s not actually separate). Any equipped tool will be parented under the player’s character.

Just to provide a little additional information each subsequent call to Backpack:GetChildren() may return the same set of children in a different order, unfortunately the child order of an instance isn’t deterministic. Well, almost all instances, team objects have a hidden read-only property named ‘ChildOrder’.

https://developer.roblox.com/en-us/api-reference/property/Team/ChildOrder

That doesn’t really matter though as you already have your own array. Obviously there’s also ChildAdded/Removed, but I didn’t really want to cover everything. Also I don’t think the order would be different as the tools will have already loaded. But not really that important anyway, I don’t think.

Unless you mean on respawn, then yes.