Xanth
|
  |
| Joined: 14 Oct 2007 |
| Total Posts: 7691 |
|
|
| 24 Jul 2016 11:31 PM |
| Is there any way to make it so a tool automatically goes to a specific slot of your inventory (aka hotkeys 1-9)? |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2016 11:35 PM |
no
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow my twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
Xanth
|
  |
| Joined: 14 Oct 2007 |
| Total Posts: 7691 |
|
| |
|
|
| 24 Jul 2016 11:40 PM |
Yes, there is a way but it's not a good way. I think your better option would be maybe to create your own custom inventory system or something.
Regardless, the way is this: local inv = backpack:GetChildren() for key = 1, #inv do inv[key].Parent = nil end table.insert(inv, SLOTINDEX, tool) for key = 1, #inv do inv[key].Parent = backpack end |
|
|
| Report Abuse |
|
|
Xanth
|
  |
| Joined: 14 Oct 2007 |
| Total Posts: 7691 |
|
|
| 24 Jul 2016 11:50 PM |
| why is that not a good way? |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2016 11:51 PM |
It just seems ugly to me. It's the only solution I could come up with so maybe there's another solution that doesn't feel as bad.
|
|
|
| Report Abuse |
|
|
Xanth
|
  |
| Joined: 14 Oct 2007 |
| Total Posts: 7691 |
|
|
| 24 Jul 2016 11:53 PM |
| From what I can tell by the code, it just reorders the backback? That does sound clunky. |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2016 11:55 PM |
| The order of the tools is determined by what GetChildren returns, which is in the order you parent things. So essentially I'm just parenting it in order again, but also with your custom tool in that specific slot you want (everything past will be shifted right one). |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2016 11:56 PM |
| The problem with this method is that if people change it themselves, it'll ruin it for them (it'd go back in order). I don't know if you can get around fixing that without a custom backpack. |
|
|
| Report Abuse |
|
|
Xanth
|
  |
| Joined: 14 Oct 2007 |
| Total Posts: 7691 |
|
|
| 24 Jul 2016 11:57 PM |
| Okay so, say I make a custom inventory, would there be a way to change the hot key for a specific item to something other than the numbers? If there is I could probably figure it out or I will make another thread but I'm just wondering. |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2016 11:58 PM |
| Yeah you can do whatever you want as long as you handle it correctly. |
|
|
| Report Abuse |
|
|
Xanth
|
  |
| Joined: 14 Oct 2007 |
| Total Posts: 7691 |
|
|
| 25 Jul 2016 12:00 AM |
| Alright, that's something I've never done so I'll probably have to spend a lot of time with it before it works properly. |
|
|
| Report Abuse |
|
|