Several questions about datastore

Issue 1: When I type

local var=somedata:GetAsync("somekey")
print(var)

I get proper answer, but when I type

print(somedata:GetAsync("somekey")

I get the expected value plus word “Instance” after it. Why?

Issue 2: When I use any datastore method (doesn’t matter if with pcall or not) my scripts just yields forever. There is no error message, nothing. It just does its job and yields.

Issue 3: I have a table in globaldatastore that I can read and I can put new fields in it, but when using GetSortedAsync on it, it just returns blank table.

EDIT: About Issue 3: turns out GetOrderedDataStore doesn’t give the same data as GetDataStore. You would think that if you create some data by GetDataStore and then get it by GetOrderedDataStore you get the same data, but just sorted, however you don’t :slight_smile: You will get completely different data altough it will have the same name. This is beyond stupid.

That’s because GetAsync returns a tuple (multiple values).

The value of the entry in the data store with the given key and a DataStoreKeyInfo instance that includes the version number, date and time the version was created, and functions to retrieve UserIds and metadata.

GetSortedAsync is only compatible with ordered data stores, not unordered (default) data stores.

I was thinking about it, but why it says “Instance”?

Because the second return value is an ‘Instance’.

It has its own properties and methods.

I understand that DataStoreKeyInfo class is an Instance, but why print doesn’t show its name? I mean when you put a string in the print() you dont get a word “string” right? Or if you put a part in the print() you get the name of the part, not a “part” word.

Because ‘DataStoreKeyInfo’ values don’t have a ‘Name’ property like ‘Part’ instances do.

Thats kind of strange they dont have any form of identicifation. Well thanks for all the answers.

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