I tried it too, dont work. I got this error:
20:56:18.147 - ReplicatedStorage.Modules.DataStore2:479: DataStore2() API call expected {string dataStoreName, Instance player}, got {string, table}
I tried it too, dont work. I got this error:
20:56:18.147 - ReplicatedStorage.Modules.DataStore2:479: DataStore2() API call expected {string dataStoreName, Instance player}, got {string, table}
I forgot about how DataStore2 started checking for value types. You can fix this by deleting lines 483-490 in the DataStore2 module. Here’s what those lines look like.
assert(
typeof(dataStoreName) == "string" and typeof(player) == "Instance",
("DataStore2() API call expected {string dataStoreName, Instance player}, got {%s, %s}")
:format(
typeof(dataStoreName),
typeof(player)
)
)
Nothing happens when the value change, I deleted those lines tho. My code:
local player = {
UserId = 249598128,
AncestryChanged = Instance.new("BindableEvent").Event
}
local BanStore = DataStore2("banned", player)
BanStore:Set("banned")
BanStore:Save()
I figured it out. Its MasterKey/UserId
. Then the actual key is a number value that reflects the amount of time the player has joined the server or something weird.
I’ve been using DataStore2 for a while and it works great. However I’m running into issues when games shutdown for maintenance. I tried binding to close to make sure everything saves properly. My players end up getting older saves however.
To add on, you can save tables and dictionaries as well.
It very much is not, I recommend just learning how to use Git submodules.
Have you confirmed you have the latest release from GitHub?
Oh! That could be it. Seems a lot have problems have fixed thanks to that. I’ve been using the Roblox Model.
@Kampfkarren Is there any limit to this DataStore, as in can we change the limit or is it non-changeable?
Does DataStore2 still work between games in the same universe? I presume it does since it’s based on DataStoreService, but just checking!
It does work within universes.
DataStore2 uses DataStoreService under the hood so yes there is the same 260k char limit per key.
Along with the 260k character limit, you cannot call :Save() too frequently. Other than that, :Set() and :Get() as much as you want.
Oh, would have loved if you could set any limit yourself, if that’s not what you meant.
I got the Datastore2 all set up for my game. One of the combined values is ‘XP’. How would I make a global leaderboard for that? There’s nothing about ordered data stores on the documentation.
There is no built in way to create leaderboards, you can use normal ordered data stores and simply set the value whenever AfterSave
is called.
Do I have to make a BindToClose
function in DataStore2?
No, DataStore2 creates a BindToClose binding on its own already.
Hmm that’s strange. Why when I shutdown server it doesn’t save my data?