hello, I like this module, but can’t figure out autocompletion for this module
I think that’s related to types, because it shows that the module returns *error-type*
for some reason after adding --!strict at the top of the main module it did work for some time, but disappeared again and I no longer can replicate this duct tape fix.
restarting studio did not help.
does this module have a remove method that actually deletes the datastore?
Simply do
dataStore.Value = nil
Is session locking enabled by default / implemented within the module itself? I am able to open a datastore with .new/:Open() in two different servers. It looks like .hidden uses session locking but I want to be able to access the cach’d datastore with .find. A simple repo is to do a studio play test and also play the same game on roblox at the same time. In this example, the players datastore is opened twice and dataloss occurs dependant on which server closes last. I want the players datastore to be session locked as soon as I use .new/:Open() and I want :Destroy to remove the session lock.
Yes session locking works all the time you cannot disable it
when you do
-- sctiptA
local object1 = module.new("Name", "Key")
-- scriptB
local object2 = module.new("Name", "Key")
both object1 and object2 are the same objects/session
print(object1 == object2) -- true
but when you do
-- scriptC
local object3 = module.hidden("Name", "Key")
this will create a new object
print(object3 == object1) -- false
print(object3 == object2) -- false
and that’s why object3 cannot open the session, because sessions are locked to objects
the same is true for actors if you do
-- script in a actor
local object4 = module.new("Name", "Key")
this will not be the same object as object1 and object2 because this actor is running in a separate VM so object4 will also fail to open the session while object1/object2 have the session open
Gotcha, thank you for clearing that up Ah, memoryservice uses a different scope in studio, thus why I could launch both a playtest and a play at the same time.
Correct you can also restart studio to reset the memorystore
if you open a session in studio and in game at the same time whoever closes last will save the final data
one thing you can do is
local RunService = game:GetService("RunService")
local dataStore = DataStoreModule.new("Name", "Key")
-- stop the datastore from saving while play testing in studio
if RunService:IsStudio() == true then
dataStore.SaveInterval = 0
dataStore.SaveOnClose = false
end
Good day sir, I still didn’t know how to clone anything if we only have a name saved in the Datastore. The item that can be clone are placed inside ReplicatedStorage. Items
local itemName = dataStore.Value.ArmorInvectory[1]
local clone = game.ReplicatedStorage.Armors[itemName]:Clone()
Can I ask what this error is?
This is a internal error that can happen for multiple reasons
Would you mind sharing your Memory Usage
and API Request Units
you should be around 2% usage on both
It just says “No data for selected period.”
I’m assuming this is because I’m only testing in-studio.
I’m just stress testing Data Store Service right now and I just wanted to know what that error meant.
Here’s the code:
local DataStoreModule = require(game:GetService("ServerStorage").MainModule)
local Data = DataStoreModule.new("a", "1")
local template = {
ahhh = 0
}
while true do
if Data:Open(template) ~= "Success" then print(Data:Open()) end
print(Data.Value.ahhh)
Data:Close()
task.wait(1/5)
end
(I know it’s bad, I’m just working on learning the module and stress testing things since I plan to use this module for an entire Roblox social media algorithm and platform.)
Thank you!
1/5 is 0.2 seconds
And 60 / 0.2 is 300 loops per minute
And your doing potentially 2 open requests and 1 close request
The module will do upto 3 retries if a request fails
I’m not 100% sure if Roblox counts a failed request towards it’s limits but let’s assume it does
So that’s a minimum of 2 memory store requests and a maximum of 9 memory store requests
So you could be doing anywhere from
2 * 300 = 600 requests per minute
9 * 300 = 2700 requests per minute
The memory store has a request limit of
1000 + 100 * players
So if your the only player in the game
Your limit will be 1100
So your code should not be hitting the memory store limit if the requests are not failing so Roblox should not technically be throttling your memory store requests
And I don’t see any problems with Robloxs memory store servers in the past week
So I’m just guessing it was a random hiccup that made the request fail
Roblox does not really tell us what this error means but you can just say it’s a error that happens on robloxs side and it can happen for multiple reasons but normally we have no control over this error and it’s a error that can happen at any time the only thing we can do is wait a little and try again but even if you get this error the open call could still be successful because the open call will retry up to 3 times
Very well written response! Thank you very much.
Also, on this – I read a few posts about it and the general consensus is that it does. (Considering it still has to process data on Roblox’s end.)
how do i use a datastore editor with suphi’s datastore module
just use it like normal but it wont work while your in game because the cached data will overwrite any changes you make
do you have an example please ?
Is it possible to get player’s data without them being in the server? If so then how can I go about doing it?
There is 2 ways
You can use open but if the player is in a different server open will fail
You can use read but if the player is in a different server read will not tell you the current cached value on the server the player is currently playing it will tell you the value that was last saved into the datastore this is done once every 30 seconds by default when the datastore has been opened if the datastore was not opened by another server then read will give you the most recent value