OpenInventory - Managing Inventories

[Deprecated] OpenInventory - Better back-end inventory management

GitHub | Roblox | Docs

I’ve noticed that there are many inventory systems/resources in #resources:community-resources.
When I took a look at some of them, I realized that it was just plug-it-in and play. So I decided to make my own resource in order to give developers a better customizable alternative.

Why not use Satchel/NeoHotbar/other open-source inventory systems?

  • OpenInventory is not a complete inventory system. It’s just a backbone of an “inventory system”, which I made because of the unlimited possibilities instead of just a pre-made boundful system.

Features

  • Strictly Typed
  • Dynamic crafting
  • Easy Debug support
  • Stringified tables for memory efficiency
  • Optimized and secure API

How to setup

  • Get OpenInventory from the links above
  • Insert it into your game
  • Require the main module
  • Call Module:GetInventory(Player)
  • Optionally, use the provided Module.SaveFunction callback to add save functionality.

Have feedback?
Feel free to leave a comment!

18 Likes

Is there any documentation for this? Your model also isn’t for sale.

3 Likes

Inside the module, sorry it’s a bit long I didn’t want to make the post look ugly
Also should be on sale now

2 Likes

for how much bobucks is it?
char limit

2 Likes

It’s free, you can check it out with the links above

4 Likes

oh so with “in sale” you meant you can get it?

3 Likes

I still don’t understand what this does… is it a hotbar backpack system ?

Screen shots?
.rbxl file available?

This is a back-end system, something that you’d run on the server.

what do you mean by dynamic crafting? i don’t really understand

It is a method that you can use with the inventory. By “Dynamic” I meant it can accept any amount of output, input, or similar parameters.

1 Like

OpenInventory v1.1 Patch

  • Better documentation
  • Dependencies are now built-in
  • Fixed a lot… of bugs

Highly recommend updating!!!
GitHub
Roblox

Hi,
In the docs, it has the comment
’ * Caution: if config.client_check is enabled, using the modules in a client environment will not work.
When and how does this get enabled, and why would it be enabled or not enabled?

Thanks

It’s a security measure to prevent exploitation. If it’s enabled, the module will not run on the client.

Sorry to bump this but I have run into an error and I’m not sure how to fix it:

ServerScriptService.OpenInventory:68: invalid argument #1 to ‘setmetatable’ (table expected, got nil)

This is where the error shows up:

built_in_signal = {
	_signals = setmetatable(built_in_signal, {}), -- Right here on line 68

Any idea of how to fix this?

This seems like a really useful module and will probably end up using it for a future project I have planned

I’ll have to investigate the issue, you can just replace setmetatable(buildt_in_signal, {}) with {} for now.

1 Like

OpenInventory v1.2 Patch

GitHub | Roblox | Wally

  • Fixed built in signal, thanks to @Bitterman1021
  • Fixed minor bugs
  • OpenInventory is now on wally! (I am aware that the wally version is wrong)
  • Removed client check recursion and it now checks only when the module is indexed
1 Like

I hate to be a nuisance, but I seem to have run into another bug. For some reason whenever I use GetInventory() to create a new inventory instance, it ends up returning nil.

Here is my code:


-----------------
--//VARIABLES\\--
-----------------

--/Services\--

local ServerScriptServ = game:GetService("ServerScriptService")
local PlrServ = game:GetService("Players")
local RepStore = game:GetService("ReplicatedStorage")

--/Modules\--

local InventoryModule = require(ServerScriptServ:WaitForChild("OpenInventory"))

--/Other\--

local ItemsFolder = workspace:WaitForChild("Items")
local Event = RepStore:WaitForChild("RemoteEvent")


------------
--//MAIN\\--
------------

--On player join

PlrServ.PlayerAdded:Connect(function(Player)
	
	local Inventory = InventoryModule:GetInventory(Player) --Create inventory (RETURNING NIL)
	
	--On Item Pickup
	for i, Item in pairs(ItemsFolder:GetChildren()) do --Loop through items that can be picked up
		
		Item:FindFirstChildWhichIsA("ClickDetector").MouseClick:Connect(function() --Detect pickup
			
			Inventory:AddItem(Item.Name, 1) --Adds item to inventory
			
			Event:FireClient(Player, Item.Name, Inventory:GetQuantity(Item.Name)) --Updates inventory UI
			
		end)
		
	end
	
end)

I did some debugging and it is firing the function and creating the instance but for some reason isn’t returning it

My theory is that its an issue with this code:


function Module:GetInventory(Player: Player): (Player) -> Inventory
	
	local target_inventory = self._manager[Player]
	if target_inventory ~= nil then -- Checks if the target inventory is nil or not
		return target_inventory -- If it's not, returns it
	else
		self._manager[Player] = newInventory(Player) -- If it is, generates a new one and appends it into the manager
	end
	
	return target_inventory
end

It seems that when the player has no inventory data it creates a fresh inventory instance but is still returning target_inventory which in that scenario would be nil
I could be wrong about this as I don’t fully understand how this module works but if I had to make a guess that’s what I’d say.

So sorry to keep bothering you.
thanks for the help

EDIT:

I made a small change to the module using my theory as to why it wasnt working and it seems to be working perfectly fine now. Here is the change I made:

Instead of having it return target_inventory I made it return self._manager[Player]
not sure if this effects anything but it seemed to fix it.

1 Like

That’s my bad, thank you for pointing it out. I’ll fix it in a moment.

1 Like

OpenInventory v2.0 Release

GitHub | Roblox | Wally | Docs
What has changed:

  • Rewrote the entire module
  • Made types more consistent
  • Further table optimizations using :JSONEncode() and :JSONDecode
  • Switched to a more reliable signal class
  • Added asynchronization using the promise class

This will likely be the last major update of OpenInventory.

2 Likes

Can we get a full documentation? Specifically crafting because it is not well documented. From what I can tell you have to manually set every crafting recipe for new players. Would it be possible to just make a dictionary that the module uses to set the recipes to?