local r=DataStore:GetOrderedDataStore("\076\066")local function f()local f,a=pcall(function()local f=r:GetSortedAsync(false,50)local a=f:GetCurrentPage()for r,f in pairs(a)do local a=game.Players:GetPlayerByUserId(f.key)local m=f.Value or 0 local g=(script:FindFirstChild("\070\114\097\109\101")):Clone()g.Player.Text=a.Name g.Rank.Text=r g.Coins.Text=m g.Parent=script.Parent if ChatService then local f=ChatService:GetSpeaker(a.Name)if f then f:SetExtraData("\084\097\103\115",{{TagText="\035"..r;TagColor=Color3.fromRGB(0,255,127)}})end end end end)if not f then warn(a)end end f()
--
local LeaderBoardStore = DataStore:GetOrderedDataStore("LB")


local function Arrange()
	-- pcall can help us to indentify and silence the errors
	
	local success , errormessage = pcall(function()
		
		local MainPage = LeaderBoardStore:GetSortedAsync(false , 50)
		local ThisPage = MainPage:GetCurrentPage()

		for i , v in pairs(ThisPage) do  
			-- i is the player's rank and v is the player's data

			local Player = game.Players:GetPlayerByUserId(v.key)
			local Coins = v.Value or 0 

			local NewFrame = script:FindFirstChild("Frame"):Clone()
			NewFrame.Player.Text = Player.Name
			NewFrame.Rank.Text = i
			NewFrame.Coins.Text = Coins
			NewFrame.Parent = script.Parent
			
			
			if ChatService then -- first checking if ChatService has loaded or not
				-- Leaderboard tags are added in the below lines
				local Speaker = ChatService:GetSpeaker(Player.Name)
				if Speaker then
					-- You can Change the TagText and TagColor
					Speaker:SetExtraData("Tags" , {{TagText = "#"..i  , TagColor = Color3.fromRGB(0, 255, 127)}})
				end
			end

		end
	end)
	
	if not success then
		-- if there is any error in the script it will warn us here
		warn(errormessage)
	end
	
end

Arrange()
