I believe that DS2 requires a player so I don’t think you can save data like that. I can be wrong though.
Is this only in studio? Do you have API access turned on?
Yeah, haha. I forgot to turn on HTTPS services so i couldn’t use datatstores. I noticed it when I was trying to test classic data stores. Overall, great module, will always use this!
Can DS2 be used with non-number values? (For example, “A”, true, or even tables?)
You should have no issue saving any of those variable types
Hi! I was looking for some clarification (from anybody) on something from the API:
My question is, does this refer to the masterkey or to the child keys? Currently I had setup my datastore to have 1 master key and around 10 “children” keys (combined). When the players loads in, I was looping through them and doing :Get() so I could setup the game (e.g. updates GUI’s). I am not currently experiencing throttling but the API suggests this is not appropriate use? Instead should I be doing :Get() on the masterkey, and then just access the children data that way? And to clarify, would I still be good to use childDataStore:Set() with no data mismatch issue?
If you have one master key, you shouldn’t reach the throttling this bullet point is in reference to.
No.
@Kampfkarren I do the basic example. I went to the server and try to change the coin value, but it didn’t save.
How are you saving your data? Have you checked if your API services are on? Can you show us your script that saves the data?
I use this one Basic Example: Simulator - DataStore2. it works fine with clickdetector brick, but when i manually change it from server, it didnt work
How are you changing it from the server? If you’re just editing a NumberValue or IntValue in your leaderstats, it won’t save, as you need to call :Increment() in order to make changes that will save.
I click on “play” button then change from client to server then manually change the IntValue. Your right, it needs :Increment() in order to make changes that will save.
Hi,
I use data store 2 in my game for months and i am really happy with results. My game needs to save items in inventory and items on player plots, unfortunately i needed to separate keys of plot save and inventory save. The way my game saves data is that every 0.5 seconds it sync player plot and inventory with datastore using :set() if it’s changed. But due to nature of that method player plots always save couple milliseconds after inventory. Which many players used to duplicate items with correct leaving time. I managed to fix this by modifying DataStore2 Module script.
This is how i changed it (Preformatted text starts in line 562 added wait(0.65)):
local playerLeavingConnection
playerLeavingConnection = player.AncestryChanged:Connect(function()
if player:IsDescendantOf(game) then return end
playerLeavingConnection:Disconnect()
wait(0.65)
dataStore:SaveAsync():andThen(function()
print("player left, saved " .. dataStoreName)
end):catch(function(error)
-- TODO: Something more elegant
warn("error when player left! " .. error)
end):finally(function()
event:Fire()
fired = true
end)
delay(40, function() --Give a long delay for people who haven't figured out the cache :^(
DataStoreCache[player] = nil
end)
end)
Can using solution like this cause any problems?
You’re just creating a race condition, yes.
Players leaving shouldn’t matter unless you have weird yielding code in the middle of your functions–setting plot, then immediately setting inventory, should have no abusable delay since it won’t run the player removing code until after that whole block is done.
Hey, how do I get the data of an offline player? I need it for a mod panel I’m creating. I know how to do it with normal DataStores but I don’t know how with DataStore2.
You can search the thread to see.
There is no native way to do it, you’d need to copy DataStore2’s approach to getting data. If you are using the Standard saving method (which I recommend you do), it’ll be much easier.
Is there a way to transfer the data to the standard save method ?
How would you be able to hide the player list using datastore2? Since it’s not using the Roblox stock leaderboard apparently. When I try and disable the player through SetCoreEnabled() it just doesn’t work. Any solution to that?