I Need Help With global leaderboad

so you may tell that i followed the dev king tutorial but the the board gui wont be added so it doesn’t show any of the players

local DataStoreSerivce = game:GetService("DataStoreService")
local LeaderBoard = DataStoreSerivce:GetOrderedDataStore("NukesLeaderBoard")

local function UpdateBoard()
	local Success, errormsg = pcall(function()
		local data = LeaderBoard:GetSortedAsync(false,5)
		local NukesPage = data:GetCurrentPage()
		for rank, Data in  ipairs(NukesPage) do
			local UserName = game.Players:GetNameFromUserIdAsync(tonumber(data.key))
			local name = UserName
			local Nukes  = Data.Value
			local IsOnLeaderBoard = false
			for i,v in pairs(game.Workspace.LeaderBoard["Cube.002"].LeaderBoardGui.Holder:GetChildren()) do
				if v.Player.Text == name then
					IsOnLeaderBoard = true
					break
				end
			end
			if Nukes and IsOnLeaderBoard == false then
				local NewLBF = game.ReplicatedStorage:WaitForChild("LeaderBoardFrame"):Clone()
				NewLBF.Player.Text = name
				NewLBF.NukesFired.Text = Nukes
				NewLBF.Rank.Text = "#"..rank
				NewLBF.Position = UDim2.new(0,0,NewLBF.Position.Y.Scale + (.08 * #game.Workspace.LeaderBoard["Cube.002"].LeaderBoardGui.Holder:GetChildren()),0			)
				NewLBF.Parent = game.Workspace.LeaderBoard["Cube.002"].LeaderBoardGui:WaitForChild("Holder")
				print(NewLBF.Parent)
			end
			end
	end)
	if not Success then
		print(errormsg)
	end
end

while true do
	for _, player in pairs(game.Players:GetPlayers()) do
		LeaderBoard:SetAsync(player.UserId, player.leaderstats["Nukes Set Off"].Value)
	end
	for _, frame in pairs(game.Workspace.LeaderBoard["Cube.002"].LeaderBoardGui.Holder:GetChildren()) do
		frame:Destroy()
	end
	UpdateBoard()
	print("Updated")
	task.wait(30)
end


the image of what happeneds in game is here and it says i the output that the board has beeen updated from the print statment


and i need help for it

I haven’t tried this module, but I think it should solve your issue:

If you don’t want to use this, seek help from someone else.

Hey there! Thanks for sharing my resource. These are the cases why I created it, It’s perfect on these cases.

1 Like