Data Store Queue

Instead of this use:

PlayerDS:SetAsync(player.UserId, {
	["Exp"] = player.leaderstats.Exp.Value,  
	["Lvl"] = player.leaderstats.Level.Value, 
	["MaxExp"] = player.Values.MaxExp.Value,
})

Then when you load the data use:

loadedData.Exp -- Exp
loadedData.Lvl -- Lvl
loadedData.MaxExp -- MaxExp

Though one problem which can occure, the player might not have any data or have some data not saved before, so we’d need to make sure of that. So when setting data use:

Exp.Value = (loadedData and loadedData["Exp"]) or 0
Lvl.Value = (loadedData and loadedData["Lvl"]) or 1
MaxExp.Value = (loadedData and loadedData["MaxExp"]) or 100

The last digit is the default value, so when you first join etc. You have to make sure to edit that as well as the index of the table.

1 Like