Is there a possible way to check the size of a data?

Hi, Roblox data stores have a limit, so I was asking if there’s a possible way to check the size of how much data we’ve stored.

1 Like

You can count one byte per character at least, other encoding can raise its value. Usually because of binary conversion to character.

According to a Stack Overflow topic:

In other words, each character costs 1 B. The cap is 4 MB(4 million characters), which is very generous already. The article here already proves it: Documentation - Roblox Creator Hub

5 Likes

What exactly do you mean? If you want to check the size of a datastore that saved a table, just say #tabletocheck to get the amount of items in it?

I mean roblox data stores have a limit of 256 kb so, is there a way to check the size of the data?

Well, how much have you researched this before asking on the devforum?

I have searched that a lot of times but I didn’t find anything.

What do you need the size of a datastore for? If after all this, and you didn’t find your solution, try to keep your datastores small so you don’t need to check them if it breaks.

If you are storing data in tables, you can use HttpService:JSONEncode()

local dataStore = game:GetService("DataStoreService")
local exampleData = dataStore:GetDataStore("exampleData")
local HTTP = game:GetService("HttpService")

local suc,dat = pcall(function()
    return exampleData:GetAsnyc("Key_Name")
end)

print(string.len(HTTP:JSONEncode(dat)))

I didn’t tested it, so I can’t totally say this is works.

Also Datastore limit was increased from 256 Kilobytes to 4 Megabytes.

1 Like

Please read the documentation, it’s all there.

7 Likes