I been using the same datastore for quite sometime with my game and decided to add a global leaderboard but this script wont return or do anything, i cant figure out the problem.
local dst_nades = game:GetService("DataStoreService"):GetOrderedDataStore('Shrek_exe Nades') local Players = game:GetService("Players") local Global = script.Parent:WaitForChild("Global_Leaderstats") function Leadertext(Place,Username,Nades) return ('#'..Place..' '..Username..' | Shreknades: '..Nades) end function GetAvatarImage(Id) return Players:GetUserThumbnailAsync(Id, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420) end function GlobalLeaderstats() local sorted = dst_nades:GetSortedAsync(false, 10, 1, math.huge) local current = sorted:GetCurrentPage() for rank, data in pairs(current) do local Inst = Global["#"..rank] local UserId = data.key:match('%d+') -- (Original: "Player_012345") local Username = Players:GetNameFromUserIdAsync(UserId) local Avatar = GetAvatarImage(UserId) local TextLabel = Inst.TextLabel TextLabel.Parent.Image = Avatar TextLabel.Text = Leadertext(tonumber(rank), tostring(Username), tonumber(data.value)) end end GlobalLeaderstats(); while wait(30.0) do GlobalLeaderstats() end
Image of explorer: https://gyazo.com/108134e4d5754c598cd40c6d154e982b
Figured out that i was using GetDataStore instead of GetOrderedDataStore for saving player data...