Leaderboard script is good?

local datastoreservice = game:GetService("DataStoreService")

local datastore = datastoreservice:GetDataStore("Test")

local OrderedStore = datastoreservice:GetOrderedDataStore("Ordered")

local LeaderBoard = workspace.LeaderBoard
local Names = LeaderBoard.SurfaceGui.Frame.Names:GetChildren()
local Ranks = LeaderBoard.SurfaceGui.Frame.Ranks:GetChildren()
local Values = LeaderBoard.SurfaceGui.Frame.Values:GetChildren()

local function RemoveTableValues()
	table.remove(Names, 1)
	table.remove(Ranks, 1)
	table.remove(Values, 1)
end

local function CopyData(Key, data)
	OrderedStore:SetAsync(Key.KeyName, data)
end

local function AssignRanks(index, KeyInstance)
	if Ranks[index] and Ranks[index].ClassName == "TextLabel" then
		Ranks[index].Text = index
	end
	if Names[index] and Names[index].ClassName == "TextLabel" then
		Names[index].Text = KeyInstance.key
	end
	if Values[index] and Values[index].ClassName == "TextLabel" then
		Values[index].Text = KeyInstance.value
	end
end

RemoveTableValues()

while true do
	local Pages = datastore:ListKeysAsync()
	
	local Page = Pages:GetCurrentPage()
	
	for Every, Key in Page do
		local success, data = pcall(function()
			return datastore:GetAsync(Key.KeyName)
		end)
		
		if data and success then
			pcall(CopyData(Key, data))
		end
		
	end
	local OrderedPages = OrderedStore:GetSortedAsync(false, 100)
	
	local OrderedPage = OrderedPages:GetCurrentPage()
	
	for index, KeyInstance in OrderedPage do
		AssignRanks(index, KeyInstance)
	end
	task.wait(60)
end

The code works and all, just wanted to know if it’s good in two things.

First aesthetics, is it clean?

Second, does it do well at its function? I was wondering since I’m calling these async functions every 60 seconds is this fine? Or should I take more time to update the leaderboard.

Yes the script is clean. But I suggest you to increase the time to update the leaderboard if you have multiple leaderboards in your game.

I only have one leaderboard so…?

Yes, 60 seconds is fine.

                                         3 0 characters

I did 60 though which is a minute.