Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to acces DataStore from LocalScript?

Asked by
Tiranin 45
10 years ago

I am currently in a pickle.

All my data that needs to be saved is in LocalScript and I noticed that you can't acces DataStore from LocalScript. Is there any way to bypass this? I already tried with ModuleScripts, but still says that I can't acces it from client.

2 answers

Log in to vote
0
Answered by
jobro13 980 Moderation Voter
10 years ago

There is no way to access this from a LocalScript. This is due security concerns - if a client could change the Data, if someone would exploit the game he/she could wipe all data.

In other words, you need to setup some server communication.

What my game does is create a model in ReplicatedStorage - the name of that model is the userId. I then created a function on a Server Script which detected if something was changed in this model. If it was changed, the model gets converted to a table which is then saved.

I suggest you do the same - creating it as model gives you the data a visual appearance.

Ad
Log in to vote
0
Answered by 10 years ago

You can't access any data from a local script. And you will have to use data persistance if you want to save data. Run it through a regular script that saves date once you leave.

Answer this question