How to make Shopping Menu

I wanted to make shopping menu (like the one from bedwars), i mean that i make, for example block (on this menu ofc), and if i click this block, its gonna make new items, like when i click stone, then i gonna have blocks: stone, andesite etc. on this GUi and if i click then on the andesite, i buy it, and i don't know how to detect if i have money, its gonna be on scoreboard. I wanted to make it on donkey and every player would have their one, but it doesnt matter tbh it just needs to look like the one shop from bedwars, but invisible. I wanted to make guns shop btw, i just need some help :p
Continue to help post