[Stoway] Modular Inventory/Hotbar system

Introduction


Hi, I’m yyumchi, and this is Stoway.

About a year ago, I needed an inventory system for a game idea but found the default Roblox tools lacking. I really liked Deepwoken’s hotbar and sectioned backpack, So I looked for an existing solution but came up short. Then I found a tutorial by HowToRoblox, basically copied the core code to get something working. However, as I added features, it became pretty clear to me that the UI updates were unreliable, the item tracking was wonky, and the hardcoded logic was so messy it was a nightmare to maintain.

Fast forward to December: I finally found time to rebuild it properly. I completely changed it to a headless server architecture alongside a modular client, ensuring total separation of concerns. It now features Fusion-powered UI with delta replication for performant updates, data-driven state management, and a robust context-aware input system (powered by IllusionIAS) to seamlessly handle cross-platform controls. It’s no longer just a tutorial copy and now it’s actually something I’m happy with.


Key Take Aways

  • I recommended you use the backend and use the frontend as an example.
  • This is fully free and Open Source
  • This is a side project and isn’t something I’d recommend in a lot of roblox games
  • This post isn’t a full tutorial but rather to showcase most of the features
  • Some features maybe integrated but not fully implemented (dynamic slots)
  • This bypasses the entire backpack logic so anything added to the backpack will not be recognized by the system
  • This is a server first approach, but the client does operations immediately with checks so that there is no delay waiting for when the server finally does updates
  • What differentiates this from other Inventory/Hotbar and Backpack Systems is:
    1st the fact everything goes through the InventoryService. If we want tools to be added to the system when a tool is added to the players backpack from the server you’d have to do that outside of this service.
    2nd the fact that the backpack doesn’t have any tools can prevent exploiters from seeing other player’s inventory
    3rd you don’t even need my frontend client and the inventory system will still work as it is headless.
  • This is all on branch v2 and the release for v2 will be out shortly after this post with all the instances you would need.
  • Lastly this is meant for use with a module loader

Links


Features

Hotbar

  • 🖐️ Drag & Drop

    dragging

  • :high_voltage: Static Slots/Dynamic Slots.
  • ⌨️ Keybinds

    = binds-ezgif.com-video-to-gif-converter

Backpack / Storage

  • Data-Driven: Items are stored as pure data (UUIDs), not physical Instances.
  • 📚 Stacking

    stacking

  • :balance_scale: Weight System: Optional weight/capacity limits
  • 🔍 Sorting & Filtering: Built-in support for sorting by Rarity, Name, or ItemType, plus real-time search filtering.

    sorting-ezgif.com-video-to-gif-converter

Advanced Systems

  • :atom_symbol: Reactive UI (Fusion): Uses the Fusion library
  • :satellite_antenna: Delta Replication
  • 🎨 UI Skins: Support for multiple UI layouts/skins

    setui-ezgif.com-video-to-gif-converter

  • :gem_stone: Rarity Support: Integrated rarity system with color-coded borders and sorting priority.
  • 💧 Droppable Items

    dropping1-ezgif.com-video-to-gif-converter dropping2-ezgif.com-video-to-gif-converter

  • :video_game: Console Support

:speech_balloon: Debug Commands

Stoway comes with built-in chat commands on the server for testing purposes.

  • /inv - Print current inventory state to console.
  • /add [itemId] [amount] - Add an item to your inventory.
  • /remove [uuid] - Remove an item by UUID.
  • /clear - Wipe your inventory.
  • /set_limit [n] - Change your weight limit at runtime.
  • /setui [UiType] - Switch your UI skin (e.g., /setui Default).

Flow of code

Staring from a proximity prompt
  1. Server: Trigger & Logic
    A server script calls InventoryService to add the item.
  • InventoryService: Validates the item exists in ServerStorage and calls the operation logic.
  • AddOperation:
    1. Checks limits (Empty inventory = OK).
    2. Checks stacking (No existing item = Skip).
    3. Placement Logic: Since the inventory is empty, it prioritizes the Hotbar. It finds Slot 1 is available.
    4. Generates a UUID and updates the server-side state.
  • Replicator: Packages the new Item Data and its location (Hotbar Slot 1) and fires the remote to the client.
  1. Network Boundary
    The InventoryUpdate RemoteEvent fires with the Action “Add”.

  2. Client: Update & React
    The client receives the packet and updates the local view.

  • NetworkHandler: Receives the “Add” signal and routes it to the controller.
  • InventoryController:
    1. Adds the item data to the local Items list.
    2. Updates the local Hotbar list to show the new UUID in Slot 1.
  • InventoryStore (Fusion): The Hotbar Atom detects the change.
  • UI (SlotFactory): Because the UI is bound to the Store, Hotbar Slot 1 automatically renders the new item icon.
Client-Side Flow: Dropping an Item (Console)

Here is the flow when a console user drops 1 Apple from a stack of 2.

  1. Input Trigger (SelectionManager)
    The process starts when the user presses the Drop Bind (e.g., ‘X’) while highlighting a slot.
  • Module: SelectionManager.luau
  • Action: dropAction.Activated fires.
  • Logic:
    1. HandleDrop() is called.
    2. Fetches item data (Stack of 2 Apples).
    3. Switches input context to InputManager.ContextDrop (disables navigation, enables Drop UI controls).
    4. Calls ConsoleDropUI.Show(item, 1) to display the slider.
  1. UI Interaction (ConsoleDropUI)
    The user sees the drop slider, currently set to 1.
  • Module: ConsoleDropUI.luau
  • Action: User confirms the amount (presses ‘Drop’).
  • Callback: Fires the OnDrop callback defined in SelectionManager.
  1. Client Logic (InventoryController)
    The callback triggers the core inventory logic.
  • Module: InventoryController.luau
  • Function: Controller.Drop(slotType, slotIndex, amount: 1, REPLICATE: true)
  • Optimistic Update:
    • Since amount (1) < stack (2), it performs a Partial Drop.
    • Updates local Items atom: Apple count becomes 1.
    • Updates local Weight atom.
  • Network: Sends Drop packet to server: { slotType, slot, amount: 1 }.
  1. Server Verification (DropOperation)
    The server receives the request and validates it.
  • Module: DropOperation.luau
  • Function: Execute(state, player, slotType, slot, amount)
  • Validation:
    • Checks if player allows dropping (state.Settings.Droppable).
    • Checks if item allows dropping (item.Metadata.Droppable).
    • Validates amount (1 <= 2).
  • Action:
    1. Remove Operation: Decrements the server-side item stack by 1.
    2. ItemSpawner: Spawns the physical “Apple” tool (Amount: 1) near the player.

Some Syntax

Server Core State
export type ItemInstance = {
	UUID: string,
	Id: string,
	Amount: number,
	Metadata: { [string]: any }?
}

export type PlayerSettings = {
	Limit: number,             -- Weight limit (0 = infinite)
	CanStack: boolean,         -- Allow stacking
	MaxStackSize: number,      -- Max items per stack
	MaxHotbarSlots: number,    -- Number of hotbar slots
	Droppable: boolean,        -- Allow dropping per player
	UiType: string, 		   -- Interface version to load (default, admin, mod, developer, content, spec, etc)
}

export type InventoryStateType = {
	Player: Player,
	Items: { [string]: ItemInstance },      -- UUID -> Item
	ItemsByID: { [string]: { string } },    -- ItemId -> Array of UUIDs (for stacking lookup)
	Hotbar: { [number]: string? },          -- Slot -> UUID (Static: nil holes allowed)
	Storage: { string },                     -- Array of UUIDs (Dynamic: packed, no holes)
	EquippedItemUUID: string?,              -- UUID of currently equipped item
	Weight: number,                          -- Total item count (sum of all stack amounts)
	Settings: PlayerSettings,               -- Per-player settings (modifiable!)
}
Server API
InventoryService.AddItem(player, itemId, amount, nil, true)
InventoryService.AddToBackpack(player, itemId, amount, nil, true)
InventoryService.StackTwoSlots(player, fromType, fromSlot, toType, toSlot) -- WIP because the system already does atuomatic stacking if the setting is turned on
InventoryService.RemoveItem(player, uuid, amount, true)
InventoryService.SwapSlots(player, fromType, fromSlot, toType, toSlot, true)
InventoryService.EquipSlot(player, slotType, slot, true)
InventoryService.UnequipSlot(player, true)
InventoryService.DropItem(player, slotType, slot, amount, true)
InventoryService.SyncSettings(player)
InventoryService.ReloadClient(player, { configSettingName = uiType, RefreshData = true }) -- true means to load in the current servers data to the client
Settings
-- Configuration for the Inventory System V1.2

local Settings = {}

--// Types
export type HotbarType = "Static" | "Dynamic"

--// Hotbar Settings
Settings.Hotbar = {
	Type = "Static" :: HotbarType, -- Static: fixed slots with holes, Dynamic: packed array
	MaxSlots = 10,
}

--// Storage/Backpack Settings (Always Dynamic)
Settings.Storage = {
	Limit = 15,             -- Total weight limit (Hotbar + Storage combined)
	CanStack = true,
	Sorting = true,
	MaxStackSize = 5,
	SortOrder = "None" -- Name, Rarity, ItemType, None
}

--// Stacking Rules
Settings.Stacking = {
	-- Fields that MUST match for items to stack
	RequiredFields = { "Rarity", "Type" },
	-- Rarities that can NEVER stack
	Blacklist = {
		["Legendary"] = true,
		["Mythic"] = true,
		["Special"] = true,
	},

	Rarity = true
}

--// Gameplay Settings
Settings.Gameplay = {
	Droppable = true,
	DropDistance = 10,
}

Settings.DifferentUIs = {
	Default = {
		FolderName = "StowayGui",
		GuiName = "Stoway",
		HookPresetName = "DefaultHooks"
	},
	
	Admin = {
		FolderName = "StowayAdmin",
		GuiName = "AdminGui",
		HookPresetName = "AdminHooks"
	}
}

return Settings

Credits

  1. HowToRoblox - Core mechanics inspiration.
  2. Knineteen19 - Persistence and stacking logic.
  3. Avafe - Fusion and React patterns on Roblox.
  4. Illusion - Module around roblox’s new InputActionService
7 Likes

Hi there,

Thanks for using IIAS.

I checked your project and found that you were using a really old version of it, I tried with the latest and it seems to work the same.

For the Hotbar, maybe link the buttons to IIAS using the :SetUIButtont() event, it will optimize your system a lot.

I suggest you update it !

Illusion.

1 Like

Hi,
I noticed a few things when checking out your testing place.

  1. when you get the guitar, shield or shovel ,via the giver , then drop it in the the workspace, when you pick it back up, it does not show up in the hotbar area

also when I have the shovel and sometimes if I hit the backspace to drop it, it drops a shovel but does not removed it from my inventory… this example I got one shovel from the giver and then I have backspaced twice , and I still have one

Also if I then pick up a shovel, it is in my hand, but not in my inventory, then if I activate the sword, I have two tools now in my hand…

Then some questions.

  1. Can you add it so that if your mouse cursor is inside the hotbar area, you can use the scroll wheel to activate and switch tools , via just moving the mouse wheel… for example if my tool is 3 and my mouse icon is inside of the hotbar area, and I mouse scroll down, it activates slot 4. Other open source hotbar roblox systems have this.

  2. Is there slot limiting, like if I only want a player to be able to have 6 slots, and can never pick up 7. if they try to pick up 7 it does not let them and the tool stays on the ground (or is not given to them)

  3. for a feature add on of 2 above, if you have a slot tool active say slot 1, AND all of your tools slots are full, if you pick up a tool, it will drop the tool in slot 1 which was active, put the new tool in slot 1 and make it active.

  4. how can I change the look of how a tool icon looks when it is active, like instead of the 4 arrow things, if instead I want it to be a frame?

  5. how do I change the outside grey area to like an image of a frame?

  1. Do tool effects , damage , animation work the same, or do you need hooks into you system to make them work?

  2. what are these for?

2 Likes

Thanks for the update and I will definitely be updating to the newer version.
CoraçaozinhoGIF

Thanks a lot for the feedback,

Adressing the issues with dropping to the workspace and it not being added back to the inventory even though its in the backpack is because the server does not check anything added to the backpack then registers/adds it to the inventory. Like I said in my key takeaways the systems bypasses the backpack logic all together so you’d have to add a server script that checks tools added to the backpack and use InventoryService.AddItem(player, ChildAdded.Name, amount: number of times the single tool with all its metadata will be added to the inventory, nil: overide any metadata, true: replicate this operation to the client)

Addressing the your suggestions:

  1. I’ll add this to the drawing board
  2. There isn’t really a dedicate way to limit slots so I’ll add this as example to the documentation not as a general feature as this is a more niche feature (but if you mean to change how many slots a person can have you can change that easily in the settings but if limiting slots mean you have a set amount but you cannot add to specific slots because they’re limited then yeah I’ll add that to the docs)
  3. I’d prolly have to change a lot of logic as this would just add the tool to the backpack if the storage limit allows it (so I’ll add a global setting to disable the backpack which will accomplish this)
  4. You would have to change the ui itself under ReplicatedStorage → Gui → FolderName → ScreenGuiName → Slot:Folder → template:frame → selectionicon:imagelabel | frame or you could change the frame itself inside of the Hooks module under FolderName | Default → HooksFuncs as hooks is where all custom code should go so it can be specific to the uiskin
  5. consider looking that the other uiskins like Admin or Grass under the Gui folder in replicated storage as I provided those as templates
  6. the system does not handle anything relate to tool actions so things like cooldowns should be passed thru the server as metadata and replicated to the client to show it (I’m bringing this example to the docs) but if you would want custom effects to happen to the slot on the hotbar/backpack when a specific tool is activated then OnEquip in hooks is where that would be done so I’ll add this to the list of examples to add to the docs
  7. Nothing really, was purely there for me to copy paste some logic for the AdminHooks OnSlotHover event
1 Like