Can anyone help making pet exists?

Can anyone help making exclusive pet in store that costs robux and has exist 40. After every bought pet exist will decrease. Its not that hard to make but how can I make it work without any bugs in datastore cuz if it’ll be changing too fast, datastore will glitch

1 Like

a note to the situation, it is slightly complicated if robux purchase is involved. because it can be a time that, if implemented naively

  1. player A wants to buy
  2. check for pet count left, let’s say only the last one is available
  3. player A prompt for MarketService to pay, the paying process is on going
  4. player B wants to buy
  5. check for pet count left, the last one is still available at this moment
  6. player B prompt for MarketService to pay as well
  7. so whichever playerA or playerB finished the paying process would get the pet
  8. the other player now paid, but can’t get the pet

so how its possible to make this thing work good?

Before the purchase u put the id of the player in a sorted datastore, when he purchased u remove him and remove one exist, so its basically making a queue system for all servers !
Hope this helped and have a nice day !