Whats a good method to make a shop system

How do you create a shop system, like should I use int values or should I use tables

I have tried using gui buttons and just putting a script into every button

2 Likes

Making shop systems requires some knowledge:

  • Lua (obviously)
  • Roblox Client-Server model
    • Remote Events
  • Gui

Here are two examples on how you can do this:

Folders

U can put a folder inside the player which will represent the purchases. And everytime a player purchases something, put something inside the Folder

Custom Module

Create a custom module that will handle the purchases. Everytime a player purchases something in your module have some kind of module.Purchase(player) function. And then store the purchases in a table

Notes:

  • Always have Sanity checks on the server. If you don’t then your game will be exploitable easily.
  • If you want to save purchases use Datastores

That is bad practice, if you change one script, you’ll have to change all of the other scripts

11 Likes

Before you have a shop, you should insert a folder called “leaderstats” into the player at the start of the game, and your currency (an intvalue, or some other type of value) into it, and it will show up on the leaderboards.

Alvinblox makes great tutorials on this.
If you want to make a simple gui shop, then see this tutorial:

If you want a more complex tool shop, see this tutorial: (note, this is the first of five parts, but it’s a good tutorial which was very helpful in my game).

For a datastore tutorial, either see this tutorial or pick your own:

3 Likes