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

Data Storage problem? ['SOLVED']

Hello, I'm currently messing around with data store and trying to do things. The code I need help with is :

local ds=game:getService('DataStoreService');
local mds=ds:GetDataStore('0x111999555','main');
local ads=mds:GetDataStore('accounts','accounts_storage');

The error I get is : 15:38:00.590 - GetDataStore is not a valid member of GlobalDataStore 15:38:00.592 - Script 'Workspace.Script', Line 3 15:38:00.593 - Stack End

1 answer

✓ Accepted answer

GetDataStore is only a method that can be used on the DataStoreService. On line 3, you are attempting to use this method on the GlobalDataStore "0x111999555". GlobalDataStores are stored inside of the DataStoreService; they are not the same thing. If you want to create ANOTHER GlobalDataStore, used the GetDataStore method on the service again, not the existing GlobalDataStore.

local ds=game:getService('DataStoreService');
local mds=ds:GetDataStore('0x111999555','main');
local ads=ds:GetDataStore('accounts','accounts_storage'); --Notice how ds is the DataStoreService, while mds is an existing GlobalDataStore. You want to run GetDataStore on DataStoreService, or ds rather than mds.

If I helped you, be sure to click the Accept Answer button below my character! :D

5 comments

0

Thank you! This does answer my question, but why does ROBLOX disallow data stores running on data stores?

0

A DataStore is pretty much like a folder. Inside a DataStore you get entries, which include keys and values. A key is pretty much the name of the entry, and the value is the value that the entry holds (As of which can ONLY be numbers, strings, booleans, or tables). They created DataStores as folders to help with organization. Think of it like real life. Would you put a folder inside of a folder to

0

Would you put a folder inside of a folder to organize your things? Nope; you would have one folder for everything in that subject. It's pretty much the same thing. The DataStoreService holds the DataStores (the folders). Here's a helpful analogy: The DataStoreService is a 3 ring binder, and the DataStores are the folders which are inside the binder. You wouldn't put a folder inside of a folder; yo

0

You wouldn't put a folder inside of a folder; you would just get a different folder for that subject (like creating a new DataStore in the DataStoreService). :)

0

Okay, thanks!

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