Leaderboards not working

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I would like to make a new leaderboard, and I used TheDevKing’s way of making the leaderboard as it is efficent, and quick.

  1. What is the issue? Include screenshots / videos if possible!

I tried to do everything he does, although the output shows no response and it doesn’t show any statistics.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I have been looking for the same exact problem, found no solution.

1 Like

I’m confused a little on whats going on could i see the script?

1 Like

local DS = game:GetService(“DataStoreService”)
local WinsLeaderboard = DS:GetOrderedDataStore(“Wins”)

local function UpdateLeaderboard()
local success, errorMessage = pcall(function()
local Data = WinsLeaderboard:GetSortedAsync(false, 5)
local WinsPage = Data:GetCurrentPage()
for Rank, data in ipairs(WinsPage) do
local user = game.Players:GetNameFromUserIdAsync(tonumber(data.key))
local name = user
local Wins = data.Value
local isOnLeaderboard = false
for i, v in pairs(game.Workspace.Leaderboard.LeaderboardGUI.Holder:GetChildren()) do
if v.Player.Text == name then
isOnLeaderboard = true
break
end
end

		if Wins and isOnLeaderboard == false then
			local NewLbFrame = game.ReplicatedStorage:WaitForChild("LeaderboardFrame"):Clone()
			NewLbFrame.Player.Text = name
			NewLbFrame.Wins.Text = Wins
			NewLbFrame.Position = UDim2.new(0,0, NewLbFrame.Position.Y.Scale + (0.08 * #game.Workspace.Leaderboard.LeaderboardGUI.Holder:GetChildren()))
			NewLbFrame.Parent = game.Workspace.Leaderboard.LeaderboardGUI.Holder
		end
	end
end)

if not success then
	print(errorMessage)
end

end

while true do

for _, player in pairs(game.Players:GetPlayers()) do
	WinsLeaderboard:SetAsync(player.userId, player.leaderstats.Wins.Value)
end

for _, frame in pairs(game.Workspace.Leaderboard.LeaderboardGUI.Holder:GetChildren()) do
	frame:Destroy()
end

UpdateLeaderboard()
print("Updated!")
wait(10)

end

1 Like

I think your problem here is this is a Datastore, not leaderboards. Datastore just saves the player’s data

What do you mean Of the new leaderboard?

Yeah the name is dataStore not a “new leaderboard”

I think he wants a leaderstats but made a Datastore instead

No, you are wrong. I want to make a leaderboard, as leader stats is made already

It is used as a datastore, not as an object

Thats not a leaderstats though you sent a datastore?

It is a global leaderboard, it’s supposed to be sent

The problem is, its not showing the stats aren’t showing up in the actual leaderboard

is it like a ranking leaderboard??

Yeah, watch TheDevKing’s video on global leaderboards

Have you published your game yet? and enable “Enable Studio Access to API Services”, If it’s not a game data can’t be saved or loaded.

I have already done that, I even tried playing it in the actual game.

i would suggest trying to rewatch the video to see if you misspelled anything

I didn’t, but I’m working on a new model due to the fact I can’t make it correctly

Line 11: data.Value loaded as nil, try data.value instead.

1 Like