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

Data Storage problem? ['SOLVED']

Asked by
0x72 20
9 years ago

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

Log in to vote
1
Answered by
Discern 1007 Moderation Voter
9 years ago

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

0
Thank you! This does answer my question, but why does ROBLOX disallow data stores running on data stores? 0x72 20 — 9y
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 Discern 1007 — 9y
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 Discern 1007 — 9y
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). :) Discern 1007 — 9y
0
Okay, thanks! 0x72 20 — 9y
Ad

Answer this question