I've been working on a Inventory where you can put armor/weapons onto your character kinda like minecraft but I cant get it right can someone help me?
There are a couple components to making a basic inventory system. If you aren't very adept at Lua, I suggest using the player.Backpack already ingame.
Anyways, to start off you will need to assign a table to hold the items:
local inventory = {};
When a player picks up an item you will need to insert it into the inventory table:
table.insert(inventory, item);
You can create a basic pickup item function using the player's mouse (game.Players.LocalPlayer:GetMouse()
) and getting the target. Once you get that target you will need to check two things:
If the target is nil and
if the target should be picked up.
If you do not check if the target is nil, then you will get an error everytime you look into space and if you do not set specific items to be picked up, you will end up allowing them to pick up the entire map.
Next you will need the ability to equip the item somehow. This can be done various ways so I won't really get into this.
Those are the basics of making an inventory, if you have some questions, please ask.
You should first give us an idea of what your inventory looks like, and if you have a GUI or a Script, or something.