Current Version: V.1.0 BETA (07/13/2021)
This is my first post in addition to my portfolio on the forum, constructive criticism is always welcome!
Absolute control over your tool/inventory objects
Easy to grasp and intuitive structure
No credits necessary and full help support available!
Developers like having absolute control over important aspects of their games which is why I think this system can be a convenient resource. ‘Tools’ and ‘Inventories’ are treated as objects. Each tool is a class extending from the ‘Base’ class that defines some essential events and utilities. The inventory object houses all the tool objects inside it, the client has a copy of its inventory which is kept up-to-date with its server-side counterpart.
Package.rbxm (15.3 KB)
Inventory-System-1-0-BETA.rbxl (173.9 KB)
How To Use
This is how things are set-up:
Server Inventory System Tool System Tools <classes> ToolBase <class> Inventory System InventoryBase <class> InventoryService Client Inventory System Tool System Tools <classes> ToolBase <class> Inventory System InventoryBase <class>
To get started, clone the ‘ExampleTool’ module found in the ‘Tools’ folder and start writing your functionality in the ‘Init’ function. To modify what Tools are given when a player spawns, open the ‘InventoryService’ module and edit the ‘StarterPack’ table. More settings for inventories can be configured in the ‘InventoryBase’ module.
Let me know what you think, and please don’t hesitate to post your creations using this module in the replies below!
Click here to read the API
InventoryObject InventoryBase.new(Player player)
Creates and returns a new inventory object for the specified player
Returns an array of tools for use by the client
ID = number, Name = string, Key = string, Storage = boolean } > Key is the KeyCode this tool is equipped/unequipped if it’s in the hotbar. Storage is false if the tool is in the hotbar, false if it’s in ‘Storage’
number InventoryObject:AddTool(string toolName)
Adds the tool with the specified name to the inventory and returns the added tool’s ID, the Init function of the new tool object is called after it’s added to the inventory
void InventoryObject:RemoveTool(number toolId)
Removes the tool with the specified id, the Destroy function of the found tool is called before it’s removed from the inventory
void InventoryObject:MoveTools(number fromId, number toId)
Swaps the position of the tools with the specified ids
void InventoryObject:EquipTool(string key)
Equips the tool with the specified equip/unequip key, Equipped event of the tool object is fired
Unequips the currently equipped tool, Unequipped event of the tool object is fired
Activates the currently equipped tool, Activated event of the tool object is fired
Creates and returns a new tool object
Fired when the tool is equipped
Fired when the tool is unequipped
Fired when the holder of the tool presses the LMB
A utility object for keeping track of cleaning script connections.
This function must be present in your tool classes, it is called after the tool is added to an inventory
This function must be present in your tool classes, it is called before the tool is removed from an inventory
Current Version V.1.0 BETA (07/13/2021)
- Features listed above