Leaderstats and Datasave Questions/Concerns

Hi i’m Madden21fan or Madd I haven’t been Roblox devolving much but I would like to get back into once I get a new PC.

I have this worderful game idea but it’s all based upon the idea or datasaving value and stuff.

Something I struggle with.

So I was wondring if I could use a butt ton of leaderstats to leave this.

Like if someone was on the next level the leaderstats for level could be 2 instead of 1.

Then when a player enters a new script will detect there leaderstats. And give them something based on it.

There’s 2 problems

  1. Can I save over lets say 20 things under leaderstats and datasave them?
  2. I don’t want the player to actually see the leaderstats so is there a way I can get something that in not leaderstats but acts like it?
  3. Can you datasave more then just numbers??? Like letters??? Or true and false???

I know this won’t make much sense to be honest I haven’t thought this all out but leave me questions below.

Thank You for all your help

Forgot to add its a UI based game if that affects anything I said

You can make a folder in the player object called data and save the stuff there. That way it won’t show on the top right.
Just save the stuff in the data folder and load it back there when they join.

1 Like

Could you show any example of how to do this?

Since I don’t know how to approach it exaclty.

Ok now I understand how to do this thanks.

But I still am wondering,

Yes. You can save a lot of data but it isn’t unlimited. But 20 things should be well under that limit

Yes, as long as you are not going above the amount of datastore requests per minute, which normally you won’t.

Create an folder named something else other then ‘leaderstats’ like ‘data’ and just show the value on GUIs.

1 Like

What is that amount exactly, do you know?

You can find all datastore related limits here.

You most likely will not exceed that limit with the write practices, basically, don’t be saving time their values change, or even every minute, it is unneeded; in most cases you can just save when the player leaves.

So @NyrionDev and @noahrepublic

It’s time limits not Value limits??

The amount of times per minute, that is why modules like profileservice are so popular, they balance out the values to prevent being limited

1 Like

Hey @Madden21fan!

Datastores have a limit in terms of data size (I believe 4MB), so your data is only limited if it’s huge.

There are multiple ways to do this. You can store the data anywhere other than leaderstats and it shouldn’t show. I’d recommend either putting a folder inside leaderstats or putting a folder inside the player and storing your data there.

Datastores can save most privative data types, so yeah.

Quoting the dev hub:

Since keys, names, and scopes are strings, their length can be checked with string.len() . Data is also saved as a string in data stores, regardless of its initial type. The size of data can be checked with the JSONEncode() function that converts Lua data into a serialized JSON table.

Basically, if it can be encoded by JSONEncode it can be stored.

I made a script that should help you out. It saves and loads the leaderstats folder for each player.


The read/write limits are rate limits (you can only call the funciton X times per Y unit of time). There are some functions that let you see how many requests you have left.

I’d recommend reading this article:

1 Like

So how much would it take to say overdue this? How many values would you say? And is this per player or in general?

And how could one do this??

Also thnak you that cleared up a lot

1 Like

It’s not really based on the number of values. For reference, 4 MB is about 4,000,000 characters according to this converter (pretty sure that’s ASCII though. Generally the data size is huge and you won’t run into it. People save entire maps, models, and games inside datastores).

You can see how much data can be stored by using JSONEcode then converting the string length to # of bytes.

You’d just need to save it like a normal piece of data. For example, in the script I wrote I saved the data as a table. DataStore2 also saves the data as a table (to store some meta data, information about the information).

Ok so what I was going to save was what someone inputs into a text box, you know the UI you can type in…

How would I do that?

You’d just get the string (from the TextBox) then use GlobalDataStore:SetAsync and set a key (specific to the player) to the string.

Here is the API for SetAsync:

I’d recommend the automatic datastore I posted above if you don’t know very much about datastores. If you use that you basically just have to create a StringValue, set its value, then add it to leaderstats.

Oh, yes I remember these!! Thank you.

I belive there is BoolValues too then??

You know True or False ones.

Yep! There are StringValues, BoolValues, NumberValues, IntValues, CFrameValues, Vector3Values, and a bunch of others.

Note you’ll need the script for the leaderstats to save :+1:

1 Like