No, but if you’re worried about bandwidth you can always just limit your own throughput.
I’m a little confused to the use of “Datastore2.Combine”, still.
If I have two scripts in ServerStorage and they both independently use the same datastores, should I call “Datastore2.combine(main, store1, store2, store3, store4)” in both of the scripts? Or do I only need to call this in one of them?
only one of them I think, that’s what I do and it works
so basically calling through remotes for every client is better than using a .Changed event if you are already updating the leaderstats through OnUpdate, to display the latest value in a GUI component?
This has been answered in the thread before, but the only thing you need to care about is that the data store is combined before you use it anywhere.
If you already have a leaderstat, then just use Changed. It’s replicated either way.
Thank you for the help! Now that I know AfterSave is a thing, I’m going to revert the module back to it’s unmodified state.
Can’t @Crazyman32 's plugin be used with this?
Doesn’t DataStore 2 save data with some sort of scope because of its saving methods?
Image
why wouldn’t the name be DataStore2?
It can. If you searched “datastore2 data store editor” you would have found a solution. The data store name is dataStore2.Name .. "/" .. dataStore2.UserId
so that means if I join your game and your game has "coins"
data then you would do "coins/129574502"
what scope would I use?
I couldn’t find any results for editing the data , though I did for how to clear.
Image
nevermind this is an excellent solution that worked :
If I shut down servers, does the datastore still save?
yes it saves automatically when the Server shuts down I think
Can you call this from multiple different scripts or modules, and change data without them conflicting with eachother?
As answered several times before, yes you can.
I have a question regarding new servers compared to old servers.
Say I have .combine with several of my datastores, on update 1.0 I have “Data1” and “Data2”, then say in update 1.1 I add data store “Data3” to the same .combine as “Data1” and “Data2”. Then say someone join a new server with 1.1, obtains data for “Data3” then leaves, then joins an old server on update 1.0 still, would their previous Data3 be overwritten and removed? Or would it only be accessible in new servers? Would this lead to an issue where it’s necessary to shut down old servers? Or could I just use the migrate to new servers option and not worry about it? Sorry I don’t complete understand how the module works.
If they join an old server, Data3 will simply be ignored.
How would I go about accessing data of a player that isn’t in game? I’ve been messing around with the __call function in the main module, but i can’t seem to wrap my head around this.
I wish to access data of another player regardless if they are in game or not because i wish to implement a duos system where players can partner up with another player and this data saves, mainly the name of the partnering player and their user ID. But of course I will give players the option to disband this partnership. But the issue comes when both players aren’t in the same game. So if one player in another game or is offline gets disbanded by their partner, is there a way to detect this almost as if its live? If not, then a refresher every 30 seconds would check the status of the partnership.
Or am I being to ambitious and this would in fact not be an ideal system to make.
Ever since we switched to DataStore2, my game has been experiencing detrimental dataloss. The only other ODS we use is for a donation leaderboard. We do not have many donations so I don’t see why that would be a huge issue. At this point, I have no idea why data is not saving. We are using combined datastores, and only 2 keys. We use PlayerData:Get(0)
and PlayerData:Increment(x)
. I don’t see how that could cause any issues.
As a rewrite, I was planning on using this for our data (because I read that one key was better than 10 keys). Is this a good way to do it?
local DataService = require(ServerSettings.DataStore2)
DataService.Combine("Chicken_Shack_Version_Two", "Player_Data")
function GetData(Player)
local PlayerData = DataService("Player_Data", Player)
local InitialData = PlayerData:GetTable({
["Points"] = 0;
["Bux"] = 0;
["Experience"] = 0;
["Rebirths"] = 0;
["PreviousQuest"] = nil;
["LastJoinTimestamp"] = nil;
["Housing"] = {
["Plans"] = {};
["Furniture"] = {};
};
["Fishing"] = {
["Rods"] = {};
["Backpacks"] = {};
};
["Settings"] = {
["HighQuality"] = true;
["MusicOn"] = true;
["TagsOn"] = true;
["AutoUniforn"] = true;
["GenderMale"] = true;
};
})
return InitialData
end
function PlayerUpdated(Player, Value)
ServerEvents.Data.DataUpdated:Fire(Player, Value)
ClientEvents.Data.DataUpdated:FireClient(Player, Value)
end
game.Players.PlayerAdded:Connect(function(Player)
local PlayerData = DataService("Player_Data", Player)
local InitialData = GetData(Player)
PlayerUpdated(Player, InitialData)
PlayerData:OnUpdate(function(Value)
PlayerUpdated(Player, Value)
end)
end)
Thanks
So you need to get the current key, then from there, index the players datastore with that key.