How do i make a shop with equipping?

Hi there!

I’m trying to make a shop that saves the item if you bought it, and then you can equip it in the shop again.

So for example:

I buy a normal donut in the shop, the shop saves it, and replaces the “Buy” button with “Equip”.

I’d appreciate all help!

1 Like

You can use DataStores to identify if a player has bought an item across each of your game servers, and then use TextLabel.Text = "Equip" and change it’s color.

Yeah i understand, but i just can’t figure out a system on how to save everything properly and load it properly.

Have you tried anything so far? If you have, what is the code?

There are a lot of different scripts, but the main system worked like this:

  1. Loop trough the buttons, if one is clicked, fire a remote event with the price and the name of the button.

  2. On the server, grab the players cash, insert the item into a table, and then save the table.

  3. Once the player is added, or the character is added, get the table and fire a remote event to the client with the table as parameter.

  4. On the client, loop trough the table and check if “v” exists. If so, update it.

  5. Yeah this is where i kinda end. How do i make the player equip it, and not buy it again?

When the button is pressed, perform a get request from the datastore, wait until the data is returned (it’s async), and if the value is true then call a buyItem function, otherwise if it is false, perform an equipItem function.

Wow! Ofc, didn’t think about that yet! This defenitly helped, thanks!

1 Like