Help on Hotbar + Inventory system

Hey! So I have been developing this game for a few days now

And i want to know how and where I can start on making a Hotbar + inventory system,

How the system should work: You can only equip 1 tool at a time in the hotbar, And for the tool when you have it equipped It appears on your back, And once you unequip the tool and place it in the backpack it is no longer on the players back

Its just I have no idea where to start. That is all, I can code everything else that I need

Your game looks sick so far!
For the inventory system you could set up a table inside a module which has all the players in it and whatever else you want to have access to the inventory system. Example:

local module = {}

function module.AddPlayer(player)
     if player:IsA("Player") and not table.find(module, player) then 
      module[player] = {
      SlotOne = {}
       -- Repeat for however many slots you want
      }
      end
end

Fire this function whenever a player joins and whenever a player leaves save the data using whatever data storage system you want to use and then set the module[player] = nil.
Within that table you could save whatever slot the player currently has equipped. You could use metatables for this but Its really up to you.
Listen for player number inputs and change the currently equipped variable or whatever you have in the table to the slot the number is related to (as long as they have something in that slot). When this happens run a function to not only change the currently equipped variable but also update the weld on the player’s back.
Example:

  1. Player presses 1 on their keyboard
  2. FireServer with the input
  3. Check if the player has a slot which correlates with the number they pressed in this case SlotOne
  4. Run a function which:
    • Updates the currently equipped variable / currently equipped section in the table
    • Welds the model equivalent of what they have equipped
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.