local o=nil local D,Z=pcall(function()o=(game:GetService("\068\097\116\097\083\116\111\114\101\083\101\114\118\105\099\101")):GetOrderedDataStore(DATA_STORE)end)if not D or o==nil then warn(Z)script.Parent:Destroy()end local function r(o)o=o*60 local D=math.floor(o/86400)local Z=math.floor(math.fmod(o,86400)/3600)local r=math.floor(math.fmod(o,3600)/60)return string.format("\037\048\050\100\100 \058 \037\048\050\100\104 \058 \037\048\050\100\109",D,Z,r)end local H=function()if DO_DEBUG then print("\085\112\100\097\116\105\110\103 \098\111\097\114\100")end local D=(o:GetSortedAsync(false,10,1)):GetCurrentPage()for o,D in pairs(D)do local Z=tonumber((string.split(D.key,NAME_OF_STAT))[2])local H=(game:GetService("\080\108\097\121\101\114\115")):GetNameFromUserIdAsync(Z)local I=r(D.value)local s=scoreBlock.SurfaceGui s.Names["\078\097\109\101"..o].Text=H s.Score["\083\099\111\114\101"..o].Text=I s.Photos["\080\104\111\116\111"..o].Image=(game:GetService("\080\108\097\121\101\114\115")):GetUserThumbnailAsync(Z,Enum.ThumbnailType.HeadShot,Enum.ThumbnailSize.Size100x100)end if DO_DEBUG then print("\066\111\097\114\100 \117\112\100\097\116\101\100 \115\117\099\101\115\115\102\117\108\108\121")end end local I,s=pcall(H)if not I then warn(s)end

local Database = nil
local suc, err = pcall(function ()
	Database = game:GetService("DataStoreService"):GetOrderedDataStore(DATA_STORE)
end)
if not suc or Database == nil then warn(err) script.Parent:Destroy() end

local function disp__time(_time)
	_time = _time * 60
	local days = math.floor(_time/86400)
	local hours = math.floor(math.fmod(_time, 86400)/3600)
	local minutes = math.floor(math.fmod(_time,3600)/60)
	return string.format("%02dd : %02dh : %02dm",days,hours,minutes)
end

local UpdateBoard = function ()
	if DO_DEBUG then print("Updating board") end
	local results = Database:GetSortedAsync(false, 10, 1):GetCurrentPage()
	for k, v in pairs(results) do
		local userid = tonumber(string.split(v.key, NAME_OF_STAT)[2])
		local name = game:GetService("Players"):GetNameFromUserIdAsync(userid)
		local score = disp__time(v.value)
		local sufgui = scoreBlock.SurfaceGui
		sufgui.Names["Name"..k].Text = name
		sufgui.Score["Score"..k].Text = score
		sufgui.Photos["Photo"..k].Image = game:GetService("Players"):GetUserThumbnailAsync(userid, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100)
	end
	if DO_DEBUG then print("Board updated sucessfully") end
end

local suc, err = pcall(UpdateBoard) -- update once
if not suc then warn(err) end
