Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to acces DataStore from LocalScript?

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

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.

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.