Chest System Like Roblox Bedwars

Hey Everyone, I am currently working on a roblox bedwars game and I am stuck on the chest part. I am wondering if anyone can assist me in developing this chest I am trying to make a chest with a proximity prompt.
Thanks In Advance
image

3 Likes

This is how I would develop something like this, and my thinking process:

Handle Chest
  1. I would add a Folder in the chest model in workspace, where all the items would be stored

  2. Whenever an item is added, an Int value is added into the folder, the Name of the int value being the Items name, and the Value being of how much of that item is stored in the chest

  3. Whenever a item is taken, the Int value is deleted from folder

  4. All of this would happen on the server, not the clients

Handle Gui
  1. I would have the Gui stored in replicated storage

  2. When the prox prompt is triggered, add the gui to the wanted player. And start the local script

  3. Have a loop for every item that already exists, and index and load all the images of each item, based on name, and a text label to store the amount of each item

  4. Have the client listen for the folder changes of a ChildAdded or ChildRemoved, and when triggered, reload everything, so they are updated, and no two players take the same item

  5. Have the images be Image buttons, and when clicked, connect server via remote event to add item to player by Item Name, and the Amount by the Value. Then remove the IntValue from the folder (from server).

  6. Have a If statement, and If ChestGui is in PlayerGui, and a player clicks an item in their inventory, contact the server again via remote events, to add the int value, and changing the name of the int value to be the item’s Name, and the value of the int value being the amount of that one item.

  7. When player Exits out of the chest gui, I would delete the Gui from the player’s Gui.

Hope this helps!

3 Likes