Started by
Shmee1501655
on
Topic category: Troubleshooting, bugs, and solutions
Hi, I am trying to make a procedure that swaps your inventory with another player's inventory. I don't know how to save a player's inventory and give it to another player. I need it to store the durability of items and the number of items. I tried having a different variable for every slot in the inventory but it didn't work. Here is my code for saving inventory:
https://drive.google.com/file/d/1ZmhFVnHmvIaW_3ImAiLMQAeLSSr6DPuL/view?usp=sharing
Here is my code for giving your inventory to another player:
https://drive.google.com/file/d/1Vsbf3E5c1WvnArxZX03ZVrO8V5GKoVKe/view?usp=sharing
Use 2 item varibles.
Save item from slot x of p1 to first varible and item from slot x of px to second and then set item in slot x of p1 to second varible and item in slot x of p2 to first varible and that's how you make item swap.
Make sure to use third varible for x.
I hope this will help you. :)
Do I have to create variables for every slot in your inventory? I also want it to be able to save every item in a player's inventory and when a player dies, give it back. I need it to work on my server but keep inventory has to be off because my server has mini games and survival mode and keep inventory has to be off for mini games but for survival mode it needs to save items.