----𝐁𝐮 𝐊𝐢𝐭 𝐇𝐞𝐲𝐞𝐜𝐚𝐧𝐥ı𝐘𝐓 𝐓𝐚𝐫𝐚𝐟ı𝐧𝐝𝐚𝐧 𝐘𝐚𝐩ı𝐥𝐦ış𝐭ı𝐫 İ𝐳𝐢𝐧𝐬𝐢𝐳 𝐕𝐢𝐝𝐞𝐨𝐬𝐮 Ç𝐞𝐤𝐢𝐥𝐦𝐞𝐬𝐢 𝐘𝐚𝐬𝐚𝐤𝐭ı𝐫


local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetOrderedDataStore("GlobalLeaderboard_" .. StatsName)
local SurfaceGui = script.Parent
local Sample = script.Sample
local List = SurfaceGui.Frame.List--𝐁𝐮 𝐊𝐢𝐭 𝐇𝐞𝐲𝐞𝐜𝐚𝐧𝐥ı𝐘𝐓 𝐓𝐚𝐫𝐚𝐟ı𝐧𝐝𝐚𝐧 𝐘𝐚𝐩ı𝐥𝐦ış𝐭ı𝐫 İ𝐳𝐢𝐧𝐬𝐢𝐳 𝐕𝐢𝐝𝐞𝐨𝐬𝐮 Ç𝐞𝐤𝐢𝐥𝐦𝐞𝐬𝐢 𝐘𝐚𝐬𝐚𝐤𝐭ı𝐫
local ItemsFrame = List.ListContent.Items

local function GetItems()
	local Data = DataStore:GetSortedAsync(false, MaxItems, MinValueDisplay, MaxValueDisplay)
	local TopPage = Data:GetCurrentPage()
	
	ItemsFrame.Nothing.Visible = #TopPage == 0 and true or false
	
	for i, v in ipairs(TopPage) do
		local UserId = v.key--𝐁𝐮 𝐊𝐢𝐭 𝐇𝐞𝐲𝐞𝐜𝐚𝐧𝐥ı𝐘𝐓 𝐓𝐚𝐫𝐚𝐟ı𝐧𝐝𝐚𝐧 𝐘𝐚𝐩ı𝐥𝐦ış𝐭ı𝐫 İ𝐳𝐢𝐧𝐬𝐢𝐳 𝐕𝐢𝐝𝐞𝐨𝐬𝐮 Ç𝐞𝐤𝐢𝐥𝐦𝐞𝐬𝐢 𝐘𝐚𝐬𝐚𝐤𝐭ı𝐫
		local Value = v.value
		local Username = "[Not Available]"
		local Color = Color3.fromRGB(38, 50, 56)--𝐁𝐮 𝐊𝐢𝐭 𝐇𝐞𝐲𝐞𝐜𝐚𝐧𝐥ı𝐘𝐓 𝐓𝐚𝐫𝐚𝐟ı𝐧𝐝𝐚𝐧 𝐘𝐚𝐩ı𝐥𝐦ış𝐭ı𝐫 İ𝐳𝐢𝐧𝐬𝐢𝐳 𝐕𝐢𝐝𝐞𝐨𝐬𝐮 Ç𝐞𝐤𝐢𝐥𝐦𝐞𝐬𝐢 𝐘𝐚𝐬𝐚𝐤𝐭ı𝐫
		
		local Success, Error = pcall(function()
		 	Username = game.Players:GetNameFromUserIdAsync(UserId)
		end)
		--𝐁𝐮 𝐊𝐢𝐭 𝐇𝐞𝐲𝐞𝐜𝐚𝐧𝐥ı𝐘𝐓 𝐓𝐚𝐫𝐚𝐟ı𝐧𝐝𝐚𝐧 𝐘𝐚𝐩ı𝐥𝐦ış𝐭ı𝐫 İ𝐳𝐢𝐧𝐬𝐢𝐳 𝐕𝐢𝐝𝐞𝐨𝐬𝐮 Ç𝐞𝐤𝐢𝐥𝐦𝐞𝐬𝐢 𝐘𝐚𝐬𝐚𝐤𝐭ı𝐫
		if i == 1 then
			Color = Color3.fromRGB(255, 215, 0)
		elseif i == 2 then
			Color = Color3.fromRGB(192, 192, 192)
		elseif i == 3 then
			Color = Color3.fromRGB(205, 127, 50)
		end--𝐁𝐮 𝐊𝐢𝐭 𝐇𝐞𝐲𝐞𝐜𝐚𝐧𝐥ı𝐘𝐓 𝐓𝐚𝐫𝐚𝐟ı𝐧𝐝𝐚𝐧 𝐘𝐚𝐩ı𝐥𝐦ış𝐭ı𝐫 İ𝐳𝐢𝐧𝐬𝐢𝐳 𝐕𝐢𝐝𝐞𝐨𝐬𝐮 Ç𝐞𝐤𝐢𝐥𝐦𝐞𝐬𝐢 𝐘𝐚𝐬𝐚𝐤𝐭ı𝐫
		
		local Item = Sample:Clone()
		Item.Name = Username
		Item.LayoutOrder = i--𝐁𝐮 𝐊𝐢𝐭 𝐇𝐲𝐞𝐜𝐚𝐧𝐥ı𝐘𝐓 𝐓𝐚𝐫𝐚𝐟ı𝐧𝐝𝐚𝐧 𝐘𝐚𝐩ı𝐥𝐦ış𝐭ı𝐫 İ𝐳𝐢𝐧𝐬𝐢𝐳 𝐕𝐢𝐝𝐞𝐨𝐬𝐮 Ç𝐞𝐤𝐢𝐥𝐦𝐞𝐬𝐢 𝐘𝐚𝐬𝐚𝐤𝐭ı𝐫
		Item.Values.Number.TextColor3 = Color
		Item.Values.Number.Text = i
		Item.Values.Username.Text = Username--𝐁𝐮 𝐊𝐢𝐭 𝐇𝐞𝐲𝐞𝐜𝐚𝐧𝐥ı𝐘𝐓 𝐓𝐚𝐫𝐚𝐟ı𝐧𝐝𝐚𝐧 𝐘𝐚𝐩ı𝐥𝐦ış𝐭ı𝐫 İ𝐳𝐢𝐧𝐬𝐢𝐳 𝐕𝐢𝐝𝐞𝐨𝐬𝐮 Ç𝐞𝐤𝐢𝐥𝐦𝐞𝐬𝐢 𝐘𝐚𝐬𝐚𝐤𝐭ı𝐫
		Item.Values.Value.Text = Value
		Item.Parent = ItemsFrame
	end
end