Saving and restoring player inventories on multiplayer server

Hi, I'm new here. Been running Minecraft servers for the last 2 years for a group of homeschooled kids. I'm currently working on a new server and I've been looking into datapacks to create some custom games. At the moment I'm trying to write some mcfunctions to save and restore player inventories. The intention would be to run these commands as players enter and exit certain areas of spawn, using Worldgaurd Extra Flags. I've been trying to follow this guide: https://minecraftcommands.github.io/wiki/questions/storeinventory.html#putting-things-in-the-original-slot-from-storage I'm testing the datapacks in vanilla Java 1.21.4. At the moment I have a scoreboard player ID system setup, I'm also able to use a storage object to store each players inventory along with an ID value from their scoreboard. I'm currently just running the functions from the in-game console. I've been stuck trying to restore player inventories from the storage object. The guide I've been following mentions using an inline loot table with macros, but I've not been able to find any practical examples of this. I've been avoiding the loot table solution for the moment and have just been trying to populate a chest directly from a storage object, but obviously the Slot data needs to be wrangled in order to accommodate armour and other inventory items that are outside of the chest's slot range (e.g. armour.chest being in slot 102). Aside from not being able to implement the loot table solution, here's an example of where I'm going wrong: data modify block ~ ~ ~ Items append from storage mcm:inv temp.Inventory[{Slot:102b}] I've attached a zip of my datapack so far, if I can get any help with this, me and the kids at our minecraft group would be super apreciative!
Continue to help post