So I found out that you cannot use profile service to make global leaderboards
I’ve decided to use profile service for my game because I’ve heard good things about it and so far it has been pretty good however I’m still learning how to use it and so I’m not entirely sure how to make a global leaderboard with it. I tried looking for a post on here, but found nothing just how to make one with regular datastore so I just tried changing it, but didn’t work lol.
local DSS = game:GetService("DataStoreService")
local DS = DSS:GetOrderedDataStore("PlayerData")
while true do
local smallestFirst = false--false = 2 before 1, true = 1 before 2
local numberToShow = 100--Any number between 1-100, how many will be shown
local minValue = 1--Any numbers lower than this will be excluded
local maxValue = 10e30--(10^30), any numbers higher than this will be excluded
local pages = DS:GetSortedAsync(smallestFirst, numberToShow, minValue, maxValue)
local top = pages:GetCurrentPage()--Get the first page
local data = {}--Store new
for a,b in ipairs(top) do--Loop through data
local userid = b.key--User id
local points = b.value--Points
local username = "[Failed To Load]"--If it fails, we let them know
local s,e = pcall(function()
username = game.Players:GetNameFromUserIdAsync(userid)--Get username
end)
if not s then--Something went wrong
warn("Error getting name for "..userid..". Error: "..e)
end
local image = game.Players:GetUserThumbnailAsync(userid, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size150x150)
--Make a image of them
table.insert(data,{username,points,image})--Put new data in new table
end
task.wait(30)
end