So im working on a script that saves every part in the game and it’s position size and rotation so if the game records exploiter then the proof will be already recorded by the system
So my problem is that this system makes a huge
Really huge data that its 5 times bigger than maximum requirements for postasync to send
1.3 more bigger than what datastore can handle and guess what all that from just 4 parts in the game
So how to compress all these so webhooks be able to take it?
You could start by serializing your data. Instead of saving position, size, and rotation directly you can save each component in a specific order. To de-serialize you just access this data in the same order.
local serialized = {
position.x, position.y, position.z,
size.x, size.y, size.z,
rotation.x, rotation.y, rotation.z,
}
part.Position = Vector3.new(serialized[1], serialized[2], serialized[3])
It’s more code but the size of this array is much smaller than roblox trying to keep the data types together. If this takes too much space you will need to assess how many parts you really need to store, and what your system is trying to do.
Save it as a string so that it takes less data
example encoded data 1,2,3,10,20,30,0.03174614906311035,-0.3492063581943512,0.9365078806877136,0.9841269254684448,0.17460322380065918,0.0317460298538208,-0.1746031641960144,0.9206348657608032,0.34920641779899597|1,2,3,0,0,0,1,0,0,0,1,0,0,0,1
This is 220 characters, so 0.0055% of the datastore limit (I think). You can then further compress this string with this
local function serialise(parts: {BasePart})
local serialised = table.create(#parts)
for i, part in parts do
serialised[i] = table.concat({part.Size.X, part.Size.Y, part.Size.Z, part.CFrame:GetComponents()}, ",")
end
return table.concat(serialised, "|")
end
local function deserialise(serialised: string)
local parts = string.split(serialised, "|")
local deserialised = table.create(#parts)
for i, part in parts do
local data = string.split(part, ",")
local size = Vector3.new(data[1], data[2], data[3])
local cframe = CFrame.new(unpack(data, 4))
deserialised[i] = {
Size = size,
CFrame = cframe
}
end
return deserialised
end
local part1 = Instance.new("Part")
part1.Size = Vector3.new(1, 2, 3)
part1.CFrame = CFrame.new(10, 20, 30, 0.0317461491, -0.349206358, 0.936507881, 0.984126925, 0.174603224, 0.0317460299, -0.174603164, 0.920634866, 0.349206418)
local part2 = Instance.new("Part")
part2.Size = Vector3.new(1, 2, 3)
part2.CFrame = CFrame.new()
-- Convert data into a string, which will take less memory
local serialised = serialise({part1, part2})
print(serialised)
-- Decode to get back original data
local deserialised = deserialise(serialised)
print(deserialised)