Errors: None

wait()
local DataStore = game:GetService("DataStoreService"):GetOrderedDataStore("Level")
 
game.Players.PlayerAdded:connect(function(player)
	wait(0.1)
	if not DataStore:GetAsync(player.Name) then
		DataStore:SetAsync(player.Name, 0)
	end
	local pages = DataStore:GetSortedAsync(false, 10)
	local data = pages:GetCurrentPage()
	updateBoard(script.Parent, data)
	wait(1.2)
--[[	if player.Name == script.Parent.SurfaceGui.Name1.Text then
		game:GetService("BadgeService"):AwardBadge(player.userId,0) COMING SOON
	end]]
end)

function getvalue(store, name)
	local val = store:GetAsync(name)
	local newval = val + 1
	return newval
end

function updateBoard(board, data)
	for k,v in pairs(data) do
		local pos = k
		local nametextbox = board.SurfaceGui:FindFirstChild("Name" .. pos)
		local oldname = nametextbox.Text
		local name = v.key
		local scoretextbox = board.SurfaceGui:FindFirstChild("Score" .. pos)
		local oldscore = scoretextbox.Text
		local score = v.value
		local function changen()
			if name ~= oldname then
				nametextbox.Text = name
			end
			nametextbox.TextStrokeTransparency = 0.7
			oldname = nametextbox.Text
		end
		local function changes()
			if score ~= oldscore then
				scoretextbox.Text = score
			end
			scoretextbox.TextStrokeTransparency = 0.7
			oldscore = scoretextbox.Text
		end
		local a = coroutine.wrap(changen)
		a()
		local b = coroutine.wrap(changes)
		b()
	end	
end

while wait(10) do
	local pages = DataStore:GetSortedAsync(false, 10)
	local data = pages:GetCurrentPage()
	updateBoard(script.Parent, data)
end