What do I want to achieve? I wanna make an item storing system, where you press a button and it sends your item to an inventory
What is the issue? I dont know how to do this, do i use tables? if so, how do i use them? is there any other way i can try?
What solutions have you tried so far? I’ve try to google it and watch videos but they dont really go into depth about this part specifically
If you can, please dont tell me EXACTLY how to do it, but instead them the the outline of it, like what i need to work with, like giving me the pieces of a puzzle but i want to assemble it myself. Thank you
It depends on what you mean by inventory, and what you mean by items really. But in simple terms, if we assume it to be something like tools. An inventory could either be a table that can be used to create tools from and store tools to, or something as simple as using a folder in roblox as your inventory to hold stuff for you (bypassing the need for tables since roblox will keep track of it).
sorry, i shouldve clarified, the items i mean are tools, and by inventory i mean a GUI made by me. When you press “store” while holding a tool i want it to put it in the inventory GUI, making a new image/text button, i want to know how to do this but im having trouble
You could try storing these tools in a folder in the player as StringValues whenever the player unequips the tool. You then loop through this folder and display everything in the inventory GUI.
Some ideas to start with that most beginners commonly are fixated at is never associate whatever you’re saving to be the actual “object/tool/instance”. What you’re saving should only be something that represents it a string/integer/etc depending on your system, but usually people would go for string an example being gloves. Then that datatype that represents that item which is string on this example, gets saved on the datastore.
Now for retrieving that item/data in your backpack system there’s few ways of doing it, either whenever you open your backpack gui it fetches it from the datastore or when a player joins you cache their entire data making it more fast compared to the former.
Assuming you want something like removing the tool from the default backpack after doing an action (pressing a button etc) then putting it at the datastore, it should be simple from stated above if you’re doing the latter technique (which cache the whole data on join) then just also put the string that represent that item in that cache. Now what I didn’t say above was the saving part. If you’re using the latter technique then you will usually only save when a player leaves. Ofc you can save whenever but usually its like that and maybe with auto saving feature. As for the former tech you’ll have to save that item representation each time you move the tool to the inventory which isn’t optimal compared to the former technique.
There’s some missing part here but this is basically the gist of it. I’d recommend using chatgpt to analyze whatever I said for more information regarding it.
I do them with folders. I store them in a folder in ReplicatedStorage and then in player.Backpack. Then, if you want to use a custom hotbar, disable the default one and I’d recommend you use ImageButtons and ViewportFrames. I dont know hoe to do this part though so you may have to follow a tutorial