Datastores loading slowly?

In the game I’m currently working on, there are levels that players can create and upload. I recently added “stats” to those levels, being plays and completions. After adding this, loading levels has taken a very long time. I recently changed the rest of the datastores to also have another directory just for their names and creator, so it can draw the data faster.

This hasn’t helped that much, meaning the only culprit left is the new level stats. I’m not sure what’s causing the issue.

local wins = 0
if completedds:GetAsync(tonumber(v.Name)) then
	wins = completedds:GetAsync(tonumber(v.Name))
end
local plays = 0
if playedds:GetAsync(tonumber(v.Name)) then
	plays = playedds:GetAsync(tonumber(v.Name))
end
new.Stats.Text = "⬇" .. plays .. "   ✅" .. wins

These are the only extra lines, each of these stores only one value, so I don’t see the problem.

Extra info:

  • I’m using ODS like this:
local playedds = ds:GetOrderedDataStore("LevelStatsDS","Plays")
local completedds = ds:GetOrderedDataStore("LevelStatsDS","Completions")
  • Each key stores one int value for the ODS

If there’s any info I’m missing, please tell me, and if you know the solution, also tell me. Thanks.

There is no need to use GetAsync 4 times.
Create a table and store the plrData in there. Save the table on leaving and on join grab the data from the table. There are a ton of tutorials how to do so.

Im currently on my phone so i cannot help alot. But my last solution i showed someone how i set up my ds. Maybe u can take some inspiration from that.

This is per ID, and it needs to be sorted properly, but you’re right about not doing :GetAsync 4 times. I can reduce that to 2 easily.