local a=DataStore:GetOrderedDataStore("\076\066")local function w()local w,j=pcall(function()local w=a:GetSortedAsync(false,50)local j=w:GetCurrentPage()for a,w in pairs(j)do local j=game.Players:GetPlayerByUserId(w.key)local O=w.Value or 0 local T=(script:FindFirstChild("\070\114\097\109\101")):Clone()T.Player.Text=j.Name T.Rank.Text=a T.Coins.Text=O T.Parent=script.Parent if ChatService then local w=ChatService:GetSpeaker(j.Name)if w then w:SetExtraData("\084\097\103\115",{{TagText="\035"..a;TagColor=Color3.fromRGB(0,255,127)}})end end end end)if not w then warn(j)end end w()
--[[ if your changing the DataStore name from LB 
		to anything else you should change it inside the saving script too
	]]
--
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()
