Suphi's DataStore Module

Any benefits to using it over profileservice (for your specific use-case, i know there’s multiple videos on this)

Is this optimized/made for more than one datastore? I would think so but I just need to be sure

I’m not quite sure what your trying to ask?

But its never recommended to use more then one datastore per player and this is always the case whether or not your using SDM

It’s because I have a building system and I would like to have a whole key per player to save plot data. Would it then be okay to use another key (in the same datastore)? Like player.UserId.."-PlotData".

the main problem with using 2 keys is lets say a player buys a item for there plot and you deduct coins from there main datastore and then give them a item in the plot datastore

then lets say when your about to save the 2 datastores the main datastore saves just fine but as soon as the plot datastore is about to save Roblox servers go down

now the player has lost there coins but does not have the item in the plot datastore

there is a way we can solve this problem

to solve this problem we need 5 datastores

mainDataStoreA
mainDataStoreB
plotDataStoreA
plotDataStoreB
slotDataStore

first you read slotDataStore and this will tell use if we are on slot A or B
if slotDataStore is A we load the data from mainDataStoreA and plotDataStoreA

then when we goto save the data we have to save into slot B

the code would look something like this

-- load data
local success, value = slotDataStore:Get()
if success == false then return end
if value == "A" then
    local success, playerData = mainDataStoreA:Get()
    if success == false then return end
    local success, plotData = plotDataStoreA:Get()
    if success == false then return end
elseif value == "B" then
    local success, playerData = mainDataStoreB:Get()
    if success == false then return end
    local success, plotData = plotDataStoreB:Get()
    if success == false then return end
end
currentSlot = value
-- save data
if currentSlot == "A" then
    local success = mainDataStoreB:Set(playerData)
    if success == false then return end
    local success = plotDataStoreB:Set(plotData)
    if success == false then return end
    local success = slotDataStore:Set("B")
    if success == false then return end
    currentSlot = "B"
elseif currentSlot == "B" then
    local success = mainDataStoreA:Set(playerData)
    if success == false then return end
    local success = plotDataStoreA:Set(plotData)
    if success == false then return end
    local success = slotDataStore:Set("A")
    if success == false then return end
    currentSlot = "A"
end

but SDM does not do this
but this is a very small edge case the chances of Roblox servers going down after just saving 1 datastore is very low but its still a possibility

Okay but let’s say that I was fine with players losing coins but not receiving the item because they could contact support or whatever, would it be fine? But thanks for taking time answering btw.

is this better than Profile Service?

2 Likes

literally read the first reply Suphi made

1 Like

if your fine with it then its ok to use multiple keys per player
1 session will use 2 set requests per minute by default
so you can have 5 sessions open per player and not hit your datastore limits

2 Likes

there is no need to be passive-aggressive, it’s very rude, I didn’t know, but thank you anyway.

Is there a list of existing games that use this module?

I’m a bit anxious to offload such an important task as data saving to a module without a good trackrecord.

1 Like

I don’t have a list of games that are using SDM

1 Like

If so, just use profileservice, but suphi made a video breaking down all three of the mainly used datastore modules and he’s already a well known scripter

Yes ProfileService is nice but it’s somewhat bloated. I like this event-based approach and the more up to date session locking system.

I’ll just use it and see. I doubt data loss would occur as there seemingly haven’t been reports of it yet.

1 Like

I wonder, if using This would let me see my Datastore without simplifying it with OrderedDataStore or any other way

I am currently Using ProfileService and so used to it (Pictures from Bloxbiz)


image

Yet i got no idea, how to Access my Datastore from roblox like this to Load every Player Data so I can make a Safe “Trade House”

2 Likes

do you know why it keeps telling me “Unable to assign property Value. string expected, got table”

2 Likes

Can you show your code and what line your getting the error

But it sounds like your doing

StringValue.Value = table
2 Likes

this is where I’m getting the error
local Keys = {“PlayerInvis”,“GravityCoil”,“Skips”,“FusionCoil”,“SpeedCoil”,“HighQuality”,“ContentCreator”,“BackgroundMusic”,“SFX”}

local function StateChaged(state,dataStore)
if state ~= true then return end
for i,name in Keys do

	dataStore.Leaderstats[name].Value = dataStore.Value[name]
end

end

Print out the dataStore.Value[name] and see what it says. You are trying to set the leaderstats to a table instead of a string.

it just says the value I set it to