Hello!
So basically what I want to do is make two leaderboards: “Most time played” and “Top Donations”.
Playtime and donation amount are both stored into one table inside a datastore.
Now I had a leaderboard setup before, but that was for only one value and since I got a datastore with two values inside a table now I can’t seem to figure out how to get the second value out of the datastore as well.
Here’s an example of what it looks like for only one value:
for a, b in ipairs(top) do
local userId = b.key
local minutes = b.value
local username = "[ERROR]"
local s, e = pcall(function()
username = SVC_Players:GetNameFromUserIdAsync(userId)
end)
if not s then
warn("Failed to get name for " .. userId .. ": " .. e)
end
local image = SVC_Players:GetUserThumbnailAsync(userId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size180x180)
table.insert(data, {username, minutes, image})
end
I thought I could use that and get the second value out of it as well, but I’m out of ideas of how to get the second value.
Forgive me, I just figured out it wasn’t the actual minute count.
Yeah it just printed a table. But I’m still not quite sure how I’ll be able to get the actual value out of it.
Thanks for helping me with this by the way, I really appreciate it.
I went ahead and did some more prints and it really seems to just be b.value = 1 and the rest is just nil.
It might not get the things I need. I’ll try and do some more debugging.
Alright I found out what was going on at some point. Now I’m being greeted with the “103: Array is not alloawed in data stores.”-error. I’ve done a bit of digging around and apparently arrays don’t work with GetOrderedDataStore().