Buying an Item from the Shop for One Player

I am trying to make a multiplayer game where players can upgrade their gear. So each player should be able to access the shop and when they press buy, the item they selected should be added to their inventory.

Currently, I am planning on implementing a system that sends player info to the shop so that the shop knows who to give the item to, but would it be better if I put the Buy Item scripts inside the player class?

Thanks for the help.

I think it would make more sense to have the code that deals with transferring items with the shop rather than the player. The script would just get who/what is accessing the shop and if the requirements are met for an item and it is purchased, automatically access the inventory of whatever is interacting with the shop and place it in if there is space. You could put this in the player class, but I feel like things would be less organized with that approach. Keeping all of the fancy shop functions together would be my ideal way to go about it.

But yeah, I think your current way of doing it is good. Send player info (inventory) over to the shop when you interact with it, and the the shop scripts would have access to it to add purchased items to it or perhaps take from it if you are selling items.