I have an error: 502: API Services rejected request with error. Value length exceeded the allowed maximum. Value length was 262744 UTF8 bytes. Maximum allowed length is 262144 UTF8 bytes
I need to compress data so my data can save, here is my saving script:
local DSS = game:GetService("DataStoreService")
local modelDataStore = DSS:GetDataStore("DataStoreName")
game.ReplicatedStorage.Save.OnServerEvent:Connect(function(player)
game.Workspace.Check.Value = "Saving.."
local models = {}
for _, model in pairs(game.Workspace.Blocks:GetChildren()) do
local modelData = {}
local primaryPart = model.PrimaryPart
local position = model.PrimaryPart.Position
local direction = primaryPart.CFrame.lookVector
modelData.ModelName = model.Name
modelData.Position = {position.X, position.Y, position.Z, direction.X, direction.Y, direction.Z}
models[#models + 1] = modelData
print(models.ModelName)
end
modelDataStore:SetAsync(player.UserId, models)
print('done')
end)
I have 2559 models to save CURRENTLY and this is just like a 10th of the world, I dont think I need to share my loading script but if it is needed lmk. Thanks, Jail

3 comments
You need to split it in lots of keys, I recommend something like 1k models per key (maybe even less)
Basically what the error means, is that the length of the names, vector3s, etc, exceed the max value a datastore can hold. Perhaps not save the part's name?
I need to save the parts name so I can get the correct part from RS and clone it into the workspace.Blocks