Problem with DataStore!

Hello everyone. I made a backpack purchase system. But I don’t understand how to save it, because the script is local and the DataStore only works on the server. I’m not asking you to write the code for me, I’m asking you to tell me a way to do it!

2 Likes

When you say backpack, do you mean inventory? How do you handle the purchase?

1 Like

remote events and i should do things on the server

1 Like

good idea!!!

make sure that you handle the purchase system on the server, you can use remote events but also be sure to handle some verification on the server (if the player has enough money for example) to prevent exploiters.

I manage a shopping system in a local script

1 Like

This would in fact make your game extremely vulnerable to exploitation.

One way to make it secure, and also be able to save is:
Make some checks on client, Fire a remote event, then on the server also do checks.
if you handle the whole part on the client, it won’t work because the backpack would only be added in the client. And so making it so that when you save the data, the server would not detect the purchased backpack. Maybe make it so that it creates a value in a folder named “Backpack” located inside the player, then when you save, loop through the folder and make a table where you would insert the values name, then when you join just make it so that it loops through the table that you previously saved to a datastore with a key, and just add a value in the folder where the value name would be the corresponding table value

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.