I assume you would know what a global leaderboard is, but if you don't then it is a leaderboard(not a leaderboard that is given when the player joins at the top right corner), that shows ranks from 1 to lets say 5. It is based off of the player's stats or leaderboard (eg. points)
Okay so now the problem. Here is my script which should work. But it is a little glitchy and I don't know why.
Stat = "Points" -- just an example local ods = game:GetService("DataStoreService"):GetOrderedDataStore(Stat) local Leaderboard = script.Parent local Top5ScoreBoard = Leaderboard.Top5ScoreBoard function updateBoard(board, data) for k,v in pairs(data) do local pos = k local id = v.key local score = v.value local nametextbox = board.SurfaceGui:FindFirstChild("Name" .. pos) nametextbox.Text = game.Players:GetNameFromUserIdAsync(id) local scoretextbox = board.SurfaceGui:FindFirstChild("Score" .. pos) scoretextbox.Text = score end end while true do local pages = ods:GetSortedAsync(false, 5) local data = pages:GetCurrentPage() updateBoard(Top5ScoreBoard, data) wait(60) end
OKAY so this is referring to a surface gui that has 10 text labels, 5 for the names and 5 for the value of the currency/points.
The problem is it wont update the score and sometimes it wont even show. Very glitchy..