Hi guys, in my game players are able to build custom maps/builds in vip servers and I would like to add an admin command to be able to save their map using Datastore.
Using this thread for reference, I’m aware I can come up with a string table and store it in a key. However, I’m concerned about data limits.
So I came up with an idea: to somehow split the data that goes over the character limit and store them into multiple keys, as many as needed. Then I can store the key names in a set datastore.
This is what I came up with:
VIPMapDataStore = game:GetService('DataStoreService'):GetDataStore('VIPMaps'),
DataToStore = {'assume', 'this', 'is', 'a', 'really', 'long', 'table', 'that', 'exceeds', 'data/character', 'limit'}
FunctionThatFiguresOutHowToSplitTableIntoMultipleTablesThatRespectsDataLimits()
local Tables = {}
-- ??????
return Tables
end
local Tables = FunctionThatFiguresOutHowToSplitTableIntoMultipleTablesThatRespectsDataLimits()
local Keys = #Tables
for i = 1,#Tables do
local String =
VIPMapDataStore:SetAsync(game.PrivateServerId..'Key'..i, Tables[i]) -- Should I be worried about data failing to save? Wrap it pcall?
end
VIPMapDataStore:SetAsync(game.PrivateServerId..'Keys', Keys)
Loading it from here is easy, I’m just worried about the saving.
Is this an efficient way to do this? If so, how would I split the table into multiple tables that respect the limits? What is the limit?
If there’s a better way to do this, I’m open to that too.
I’m not willing to pay a 3rd party to store this data.