Global Leaderboard not updating frame

  1. What do you want to achieve? I want to achieve a working global leaderboard for my game.

  2. What is the issue? The global leaderboard runs with no errors, however, the board does not update the frame. I’m using Roblox’s Billboard from a model as the leaderboard display.

  3. What solutions have you tried so far? I have tried looking for errors such as misspellings but could not find anything. The tutorial I followed closely for making this leaderboard is How to Make A Global Leaderboard in Roblox Studio - YouTube / I have read very similar posts to this on the DevForum but they do not seem of help as I am constantly rechecking.

I am just confused on why this is not updating directly to the leaderboard, as you can see at the bottom of the image it is printing a statement every time it updates the leaderboard.
Locations of scripts and frames:
leaderstats and the LeaderboardHandler - ServerScriptService
IssueScreenshot2

-- Entire script, again followed closely to TheDevKings tutorial on YouTube
local DataStoreService = game:GetService("DataStoreService")
local KillsLeaderboard = DataStoreService:GetOrderedDataStore("KillsLeaderboard")

local function updateLeaderboard()
	local success, errorMessage = pcall(function()
		local Data = KillsLeaderboard:GetSortedAsync(false, 5)
		local KillsPage = Data:GetCurrentPage()
		for Rank, data in ipairs(KillsPage) do
			local userName = game.Players:GetNameFromUserIdAsync(tonumber(data.key))
			local Name = userName
			local Kills = data.Value
			local isOnLeaderboard = false
			for i, v in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
				if v.Player.Text == Name then
					isOnLeaderboard = true
					break
				end
			end
			
			if Kills and isOnLeaderboard == false then
				local newLeaderboardFrame = game.ReplicatedStorage:WaitForChild("LeaderboardFrame"):Clone()
				newLeaderboardFrame.Player.Text = Name
				newLeaderboardFrame.Kills.Text = Kills
				newLeaderboardFrame.Rank.Text = ""..Rank
				newLeaderboardFrame.Position = UDim2.new(0, 0, newLeaderboardFrame.Position.Y.Scale + (.08 * #game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()), 0)
				newLeaderboardFrame.Parent = game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder
			end
		end
	end)
	
	if not success then 
		print(errorMessage)
	end
end

while true do
	
	for _, Player in pairs(game.Players:GetPlayers()) do
		KillsLeaderboard:SetAsync(Player.UserId, Player.leaderstats.Kills.Value)
	end
	
	for _, frame in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
		frame:Destroy()
	end
	
	updateLeaderboard()
	print("Updated")
	
	wait(10)
end

Leaderstats script (partial script)

--//Kills leaderstats
	local Kills = Instance.new("IntValue", leaderstats)
	Kills.Name = "Kills"
	Kills.Parent = leaderstats

Any help or feedback on possible errors to my code and or functionality improvements would be greatly appreciated. If you need other information please ask.

Here’s what I think you can do, make a ScreenGui in StarterGui and put the entire BillboardGui in it. Set the Adornee of the BillboardGui to the part. I believe it is because it is not in a ScreenGui which causes the problem.

Thanks for the suggestion!
I have done what you suggested but it is still not updating the frame.

--//I changed this part of the script
for _, frame in pairs(game.StarterGui.LeaderboardGui.LeaderboardGUI.Holder:GetChildren()) do
		frame:Destroy()


Any other suggestions? There are still no errors when I run the code.

I see the problem.

make a while true do factor, its not in a loop
make it repeatedly check the kills :wink:

Thanks for the suggestion!
Where do you see the problem at? On this line?

if Kills and isOnLeaderboard == false then

Thanks for the support.

on the line that makes the billboard display the kills.

I still do not know where in the script you suggest that I add the while loop. Thanks.

this is where it is, right here

Thanks for the advice. I tried it out using a while loop and unfortunately, it still does not position the frame on the board. :thinking:

Any other suggestions on what I should try doing?
I have tried to also rename the datastore and it’s the same, nothing happens.
I have tried changing up the code a bit getting rid of some unnecessary lines, still no change.
I have tried changing the name of the text labels, still no change.
Thanks

I was following the same tutorial, and I am having the same problem as you.