In the 2 hours you took to explain everything your module can do, I already learned Datastore2, implemented Datastore2, learned ProfileService to know how good Datastore2 is, read all the documentation for Datastore2 and ProfileService, and had time to fix 5 bugs in my game, none releated to datastores. So why use yours?
you cant auto update it self module, except your doing require(asset_id) not for require(path.module)
Ill soon have a 2 hour video that explains how Datastore2
, ProfileService
and Suphi's DataStore Module
work
Edit* its only 46 min long
Thanks so much for putting in the time and effort to make this module and tutorials! I really like how easy-to-use and elegant the APIs are. And about the videos, they’re awesome – I don’t think length is a problem at all. I watch them at 2x speed, and everything’s still clear. Keep up the great work.
Looks a lot more promising than ProfileService, definitely would be using this in my future projects over ProfileService
Yo suphi just to notify you
SaveDelay
is already set to 0 by default because I knew it was getting removed so this change has no effect for SDM
Nice work and creative implementation, thanks for the hard work. Your Youtube videos are also great for developers moving over to the platform who want to understand its quirks!
This seems to be a great DataStore module, so I’ve started using it (instead of ProfileService, which I never set up).
Is there a way to open another player’s profile for viewing only, even if they are in another server (therefore locking their store)? I heard of a way to do this with ProfileService, but I don’t know if there’s a way to do it other than the “queue” that I’ve heard of from your advanced tutorial video.
You can use ‘Read’ to view there last saved value but not the value that is cached on the other server
Oh, I see now. That’s pretty easy!
This is an amazing module fr, You are one of the best scirpters if not the best.
Keep it up ! but i got one question : i dont really understand what does these methods really do :Close() :Open() :Destroy().
Think of it like a text file
Open()
will open the text file
Save()
will save the text file
Close()
will save then close the text file
Destroy()
will save then close then remove the text file from memory
The main 2 that are important are Open()
and Destroy()
if you watch my basics video it will cover how to use Open()
and Destroy()
Alright thank you, but i have last question why would the module cannot open datastore sometimes, cuz in my case it seems not be opening more often.
what does print(ds:Open())
print ??
if it says locked then it means that its open by something else or it failed to close last time
if it says error then Roblox servers might be having problems
NVM i didnot even enable API access sorry for bothering
What’s the difference? Is one more efficient than the other? I have never had to use session locking but I’m curious in case I’ll have to in the future.
Session locking prevents opening the same datastore key at the same time
So let’s say a player leaves one server to enter another server before the previous server managed to save there data the second server would try to load there data before the previous server saved there latest data this would cause the player to lose data
But if you have session locking the second server would not be able to open the players data until the previous server saved and closed the session preventing them from losing data
By using the memorystore we can ensure that the session lock times out for all servers at the exact same time but if you use os.time() to workout if a session has timed out you can not be 100% sure that all servers will timeout at the exact same time because os.time() uses the operating systems clock and the operating systems clock might not be perfectly in sync between servers this allows SDM to have a smaller timeout for session locks
You can make a custom function inside the datastore
local function Set(dataStore, key, value)
if dataStore.State ~= true then return false end
dataStore.Value[key] = value
print("DataStore value changed to", value)
return true
end
game.Players.PlayerAdded:Connect(function(player)
local dataStore = DataStoreModule.new("Player", player.UserId)
dataStore.Set = Set
end)
then you can use the function like this
local dataStore = DataStoreModule.find("Player", player.UserId)
if dataStore == nil then return end
dataStore:Set("Key", 69)
you can even use signals
local Signal = require(game.ServerStorage.DataStore.Signal)
local function Set(dataStore, key, value)
if dataStore.State ~= true then return false end
dataStore.Value[key] = value
dataStore.ValueChanged:Fire(key, value)
return true
end
game.Players.PlayerAdded:Connect(function(player)
local dataStore = DataStoreModule.new("Player", player.UserId)
dataStore.ValueChanged = Signal.new()
dataStore.Set = Set
end)
then you can connect to the signal like this
dataStore.ValueChanged:Connect(function(key, value)
print("Changed", key, value)
end)
very cool, but if you ask me profileservice works just fine ._.