Suphi's DataStore Module

Is it possible to be able to omit data that is stored with this module?

For example:
image

If I wanted to get rid of the ‘Codes’ table here, how would I go about doing this?

After you have opened the datastore do

dataStore.Value.Misc.Codes = nil
1 Like

Has this been tested on a large scale by anyone yet? And if so do you recommend it? Our last game peaked at around 20K concurrent and we expect a decent player base again for our upcoming project, so I want to make sure it can handle those kind of loads before considering using this.

Im having an issue with the session locking, where I open one object with datastore.new() well call this “slot data”. Then i pull a value from that object to open another object of datastore.new() well call this one “player full data”. After incorporating this opening of objects the session locking feature seems to have stopped.

unfortunately this was not enough information for me to understand the problem

local slotDataStore = DataStoreModule.new("slot data", player.UserId)
if slotDataStore:Open() ~= "Success" then error("Failed to open slot data") end

local fullDataStore = DataStoreModule.new("player full data", player.UserId)
if fullDataStore:Open() ~= "Success" then error("Failed to open full data") end

-- slot data and full data are now both locked
print(slotDataStore.Value)
print(fullDataStore.Value)

task.wait(10)
slotDataStore:Destroy()
fullDataStore:Destroy()

-- slot data and full data are no longer locked
1 Like

Can I just say how nice this DataStore module is? I am going test it more but from what I have tested looks great! I want to get more into tables and other things before I say for sure how much I like it. Because to me one thing that really makes a module about datastores shine is the ability to go through tables of data, and I mean tables inside tables. Will edit my response after a few test.

1 Like

Hey yeah so basically the code format is fairly similar

local slotStorage = DataStoreModule.new(dataName, "User: " .. player.UserId, "SlotStorage")
slotStorage.StateChanged:Connect(StateChanged)

local dataStore = DataStoreModule.new(dataName, "User: " .. player.UserId, slotStorage.Value.currentSlot)
dataStore.StateChanged:Connect(StateChangedTwo)

-- neither dataStore data, or slotStorage data are locked

print(slotStorage.Value)
print(dataStore.Value)

slotStorage:Destroy()
dataStore:Destroy()

-- both are still unlocked

I never had this issue until I I tried using one storage to open another, if I only open slotStorage, the session locking works as intended

1 Like

you must use

slotStorage:Open()
dataStore:Open()

the load and lock the data

1 Like

alright thank you, ill need to test it more because I thought it solved my issue but it seems to be persisting

after messing around a bit with this module (amazing module btw), i’ve run into an issue
can you not access a datastore through the command line because of the session lock?

i’ve created a lil module that kinda resembles what i learned using profile service
it has a function called .Get(player, index) where if index is nil it returns the datastore.Value, and if index then it returns datastore.Value[index]

print(require(game.ServerScriptService["Data Handler"]).Get(game.Players:FindFirstChild("sagathian")))

i’ve noticed that it runs smoothly on a script in serverscriptservice
however when trying to do the exact same line running it through the command line, it says the data store is nil

if needed here is some relevant code

-- DATA STORE MODULE --

-- PRIVATE FUNCTIONS --
local function getDataStore(plyr: Player)
	
	if plyr == nil then
		error(`{plyr} | IS NIL`)
		return
	end
	
	local dataStore = suphiDataMod.find("Player", plyr.UserId)
	
	if dataStore == nil then
		error(`{plyr.Name} | DATASTORE NIL`) -- ERRORS HERE ON COMMAND LINE
		return
	end
	
	if dataStore.State ~= true then
		error(`{plyr.Name} | DATASTORE NOT OPEN`)
		return
	end
	
	return dataStore
end

-- PUBLIC FUNCTIONS --
function dataMod.Get(plyr: Player, index: string)
	if index == nil then
		return getDataStore(plyr).Value
	elseif index then
		return getDataStore(plyr).Value[index]
	end
end

everything else works perfectly fine, so we can safely assume that all the prerequisites are met to make this code run
the problem is again: can you not access a datastore through the command line because of the session lock?
thank you for your time

The command line does not run in the same virtual machine (I’m not 100% sure but this might be a new change) but what this means is that when you require the module in the command line your not getting the same module that is running by the server you can think of it like the command line is running in a separate actor

another way you can test this is by doing

shared.Test = "TEST"

then in the command line do

print(shared.Test)

you will notice it will print nil

2 Likes


Hey im using your datastore module and for some reason rarely the datastore will fail to open, the prints you see are this bit of code:

1 Like


He got loaded eventually with this many prints

If the session fails to unlock then it can take up to 5 minutes for the session to timeout

1 Like

Maybe I’m doing something wrong? how does a session fail to unlock exactly, as rare as it is it does happen and screws up someone’s data for 5 whole minutes then

1 Like

I don’t think your doing anything wrong it looks like its a internal roblox error

1 Like

is it possible to manage as an Administrator this database to give via a software?

Sure anything is possible

I think the global updates approach would most like be the best way

Using the cloud service add a list of commands to a separate datastore using updatesync

Then in game every so often use updateasync to read and clean out the list of commands

Then run them commands and a command can do almost anything you want

thank you very much there is a software to do this manipulation

Question is it intentional for roblox studio to not count towards session locking? I am able to save data from both ingame and roblox studio at the same time. And is it required to do Save() before destroying the datastore because sometimes people say they experience a bit of data loss when they leave the game if they performed actions just before leaving.