Global leaderboard help

I made a global leaderboard yesterday for fastest time to complete a level. The problem is, everyone who has data that is 0 (which means they haven’t played the level yet), are at the top. (because it is 0, in that case the fastest time.)

If this game ever gets popular, and even now, this is a big problem. Here’s the script, thank you to anyone who helps find the solution!!

while wait(1) do
	timeUntilReset = timeUntilReset - 1
	script.Parent.Parent.ResetTime.Text = "Updating in " .. timeUntilReset .. " seconds"
	if timeUntilReset == 0 then
		timeUntilReset = 10
		
		for i, plr in pairs(game.Players:GetPlayers()) do
			ODS1:SetAsync(plr.UserId, plr.Scores.BlueCoaster.HighScore.Value)
		end
		
		for i, leaderboardRank in pairs(script.Parent:GetChildren()) do
			if leaderboardRank.ClassName == "Frame" then
				leaderboardRank:Destroy()
			end
		end
		
		local success, errorMsg = pcall(function()
			local data = ODS1:GetSortedAsync(true, 100)
			local timePage = data:GetCurrentPage()
			for rankInLB, dataStored in ipairs(timePage) do
				local name = game.Players:GetNameFromUserIdAsync(tonumber(dataStored.key))
				local time = dataStored.value
				local string = ODS2:GetAsync("Player_" .. tonumber(dataStored.key))

				local template = script.Template:Clone()
				
				template.Parent = script.Parent
				template.Name = name .. "Leaderboard"
				template.PlrName.Text = name
				template.Rank.Text = "#" .. rankInLB
				template.Wins.Text = decodetimer(string)
			end			
		end)
	end
end
1 Like

Make everyone’s first number a large number or not have them added to the leaderboard until they have done the level

Making them have a high number would cause their scores (in the scores viewer ui that is in the game for example) to also be high

When they first join have there time for the level a high number. Another way to solve this could also be not displaying any time under a few seconds as no one doing it properly could do it this fast, this would also help stop exploiters

1 Like