Dictionary is not allowed in data stores


local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetOrderedDataStore("PlayerStats") DataStore:SetAsync(game.Players.xcosanxc.UserId, {
["Time"] = game.Players.xcosanxc.Time.Value;
["Strength"] = game.Players.xcosanxc.Strength.Value;

Why error ? in DataStore:SetAsync

You can only store positive integers in OrderedSataStores.
Use DataStoreService:GetDataStore("PlayerStats") instead.

Time and Strength Value is positive integers
and I use GetOrderedDataStore for LeaderBoard

Storing them in a table with key-value pairs counts as a table and OrderedDataStores only accepts raw positive integers. If you want to use the leaderboard, you have to store them in separate OrderedDataStores.

Bende Türküm bu arada,
Ben Şimdi ilk 10 listesi yapıyorum ama birden fazla böyle yapıcam bu yüzdende 2 veya daha fazla değer kaydetmesi lazım getordereddatastore,

Oyuncu çıktığı an birden fazla datastore kaydetmesi sıkıntılı olmuyomuydu ?

No, not really. Unless you’re storing data inside player that is(Like storing it inside leaderstats folder.).

In that case you should store player’s data in ServerStorage since there is a slight chance that when player leaves and you try to store player’s data the player object can get garbage collected and result in a data loss.

If you’re worried about the request budget, you can send 10 write requests(:SetAsync(), :UpdateAsync()) per player plus 60 more requests per minute so you should be fine.

1 Like