I am trying to set up a system on a server I run for my friends where they can trade certain items for points, which can then be traded in for another score representing a certain enchantment and its level which can then be added onto an item of choice. The score system I had no trouble setting up, but I can't seem to get adding the enchantments onto the item from the scoreboard correct
Keeping in mind that I don't want this to be limited to Minecraft's max enchantment values and be unlimited like when giving enchantment nbt to something in a give command. How do I do this? Is there a better way of doing the system that achieves the same thing but in an easier way?
To be clear I do not want a hard-coded solution, I need something dynamic that works with every possible short.
It doesn't need to be edited in the inventory, just edited and returned to the player in some way, even if it means putting it in a chest for them to grab or something along those lines