Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why isnt GetOrderedDataStore working for my global leaderboards gui?

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

6 comments

0

Are you getting any errors? What are your values?

0

@IOwn_You there are no errors and wym by "values"

0

I mean what are you trying to save into the datastore?

0

@IOwn_You Thrown grenades leaderstat (Numbers)

0

maybe its because you did 'GlobalLeaderstats();' at line 26 and not at line 28. you forgot the ;

0

@NoobPowerPlayzz Didn't work even with or without the ";".

1 answer

Figured out that i was using GetDataStore instead of GetOrderedDataStore for saving player data...

This discussion is preserved as it was. New answers, comments, and votes are closed.