Making a GUI shop

I want it when you buy something it saves and instead of saying buy anymore it says own and moves a frame to a scrolling frame and saves there. The GUI is made and I have already a cash system I just need help making the shop script/system. Am not very good and I don’t know how to save data. I have looked for how to do this and I haven’t found any that do it in the way I want it to work
Here is where the cash value is stored.
Capture

2 Likes

when it comes to saving, use datastores link

2 Likes

Data shouldn’t be stored under the player, exploiters can manipulate things here. Rather have data folders in ServerStorage with the player’s names & values inside the folders. Only have ServerScripts control them as well if you don’t already.

Here has link to great documentation been given:

To send data from the client to the server use RemoteEvents:
developer.roblox.com/en-us/articles/Remote-Functions-and-Events

I would also recommend storing items/upgrades on the server & not inside Gui or similar. As exploiters can also manipulate those.

1 Like

If you’re not too good in scripting and want some way yo save your data, you should definetely use Datastore2. Basically download the rbxmx archive (it is a ModuleScript) from their github and place it in your game under ServerScriptService. Then use some code they show in their documentation. It seems really simple to use

Here is the post with a better explanation

3 Likes

5th time writing this. I assume you want to display “purchased” once player buys an item so its been bought. I just did this for devproducts, heres how I did it

GUIDE
first. Detect if player clicks the UI on client (devking UI series is really good) and if they have money, fire RemoteEvent to server and change icon to “bought”. Else, have ui pop up called “you dont have enough mone, begone poor gremlin”

second, detect that remote being fired on server. Connect it to saving the players data, like SwordCountDataStore:Set(myvalue) if youre using Datastore2 (recommended)

third (edit, forgot to mention this) if the item is bought, you can unbind/disconnect the purchase click detection so players cant keep trying to buy the stuff lol

NOTES

  • To avoid hacking, put coins on server instead of client.
  • you can then check upon that server event if player really had coins, instead of just giving the sword to hackers when they fired the remote event
  • always use datastore2, its miles better than regular datastore and easier to learn honestly
2 Likes