Inventory and Crafting System


#1

Any tips on how I can create custom inventory and crafting system,I am beginner in scripting.


#2

I’d suggest taking it easy instead of jumping right into the game. Don’t aim too far above your level or you’ll fail horribly.

If you feel like you’re skilled enough, here are some things you may need:

  • FilteringEnabled experience
  • Roblox GUIs
  • Tables (for the recipes themselves)

You can find all these through a simple Google search. Good luck on scripting!


#3

From your post we don’t really get much information other than you’re a beginner and you want to make something (Please refer to the guidelines for this category for how to properly structure your post).

It would be helpful if you could tell us if you’ve tried creating one already or not. If you did and it didnt work or it’s broken, we can assist you in finding the issues and fixing them. If you need assistance with coming up with ideas for how to tackle it from scratch, please make that clear.


#4

Short answer: Start Smaller

While it would be awesome to just jump into it and create a beautiful inventory Shameless plug and crafting system. You need to learn the fundamentals, there are pliantly of awesome tutorials on the DevHub that can show you how to make some pretty cool things.


#5

You’re a beginner, therefor this isn’t exactly something you should start with as something like this could be difficult for moderate or even good scripters, especially adding security to this as well.

Now lets say you really want to pursue this (even as a beginner) how should you go about it? From my experience making an inventory is really just inserting in to a table and then reading that table. So lets say we have an inventory table named “Inventory”

Inventory = {};

This inventory table will contain everything in a users inventory as well as its data. Now you want crafting, so we can add materials and items in to this table. Now it will look something like this.

Inventory = {
   Materials = {}, -- All of our materials will be stored here
   Items = {}, -- All of the users items will be stored here
}

Now its as simple as learning how to read and manipulate your table properly. For example if each item has specific data then you could make a table for that specific item in your table.

Inventory = {
   Materials = {}, -- All of our materials will be stored here
   Items = {
      WoodenAxe = { -- Our wooden axe is the item, you can add as much data as you'd like in here.
         Amount = 1, -- We have one wooden axe
         Durability = 100, -- Its durability is 100
      }
   }, -- All of the users items will be stored here
}

Now you have a basic inventory set up! A reminder, this table should ALWAYS be set up on the server!

To get everything in a users inventory simply use RemoteFunction in order to return the users inventory, you can use a loop and then display it in a UI.

Crafting? Check all of the materials/items a user has and then compair it to your crafting recipes. If a user can craft something then you could put all of the items a user can craft in a table (on the server) and return it. Once again cycle through all of the items a user can craft and put them up for display.

Security is key when it comes to systems like this, so when a user fires a RemoteEvent in order to craft and item make sure you check to see if the user can actually craft that item before giving it to them.

Always add sanity checks!


#6

Thx :grinning::grinning:


#7

Got it!:grinning:


#8

Read most of them already.Thanks for the advice
But I had no idea from where to begin because no tutorials on youtube and google about inventory system and crafting system only things I could find was free models but they were no help


#9

That’s what I needed just a simple explanation how this system works Ty :slight_smile:


#10

You should probably mark NodeSupport’s reply as a solution if they have given you the answer you hoped for.