function module.CreateServerRanks(t)(coroutine.wrap(function()local t=main.signals.RetrieveServerRanks:InvokeServer()local y={}local S={}local g={}for t,y in pairs(main.settings.Ranks)do local g=y[1]local W=y[2]table.insert(S,1,{g;W,{}})end for t,S in pairs(S)do y[S[1]]=t end for t,g in pairs(t)do local W=g.Player local R=g.RankId local e=g.RankType local Z=S[y[R]]if Z then table.insert(Z[3],{W,e})end end for t,y in pairs(S)do local S=y[3]table.sort(S,function(t,y)return t[2]<y[2]end)end;(main:GetModule("\099\102")):ClearPage(pages.serverRanks)local W={}for t,y in pairs(main.rankTypes)do W[y]=t end local R=0 for t,y in pairs(S)do local S=y[1]local g=y[2]local e=y[3]for t,y in pairs(e)do R=R+1 local S=y[1]local e=y[2]local Z=W[e]local A=templates.admin:Clone()A.Name="\076\097\098\101\108"..R A.PlrName.Text=S.Name A.PlrRank.Text=g..(" \040"..(Z.."\041"))A.PlayerImage.Image=(main:GetModule("\099\102")):GetUserImage(S.UserId)A.BackgroundColor3=(main:GetModule("\099\102")):GetLabelBackgroundColor(R)A.Visible=true A.Parent=pages.serverRanks end end pages.serverRanks.CanvasSize=UDim2.new(0,0,0,R*templates.admin.AbsoluteSize.Y)end))()end
-- << SERVER RANKS >>
function module:CreateServerRanks()
	coroutine.wrap(function()
		local serverRankInfo = main.signals.RetrieveServerRanks:InvokeServer()

		--Organise ranks
		local rankPositions = {}
		local ranks = {}
		local plrRanks = {}
		for i, rankDetails in pairs(main.settings.Ranks) do
			local rankId = rankDetails[1]
			local rankName = rankDetails[2]
			table.insert(ranks, 1, { rankId, rankName, {} })
		end
		for i, v in pairs(ranks) do
			rankPositions[v[1]] = i
		end

		--Split players into ranks
		for i, playerRankInfo in pairs(serverRankInfo) do
			local plr = playerRankInfo.Player
			local rankId = playerRankInfo.RankId
			local rankTypeId = playerRankInfo.RankType
			local rankDetail = ranks[rankPositions[rankId]]
			if rankDetail then
				table.insert(rankDetail[3], { plr, rankTypeId })
			end
		end

		--Sort ranks by RankType (Perm > Server > Temp)
		for i, rankInfo in pairs(ranks) do
			local listOfPlrs = rankInfo[3]
			table.sort(listOfPlrs, function(a, b)
				return a[2] < b[2]
			end)
		end

		--Clear labels
		main:GetModule("cf"):ClearPage(pages.serverRanks)

		--Setup labels
		local rankTypesReversed = {}
		for a, b in pairs(main.rankTypes) do
			rankTypesReversed[b] = a
		end
		local labelCount = 0
		for i, rankInfo in pairs(ranks) do
			local rankId = rankInfo[1]
			local rankName = rankInfo[2]
			local listOfPlrs = rankInfo[3]
			for _, playerRankDetail in pairs(listOfPlrs) do
				labelCount = labelCount + 1
				local plr = playerRankDetail[1]
				local rankTypeId = playerRankDetail[2]
				local rankTypeName = rankTypesReversed[rankTypeId]
				local label = templates.admin:Clone()
				label.Name = "Label" .. labelCount
				label.PlrName.Text = plr.Name
				label.PlrRank.Text = rankName .. " (" .. rankTypeName .. ")"
				label.PlayerImage.Image = main:GetModule("cf"):GetUserImage(plr.UserId)
				label.BackgroundColor3 = main:GetModule("cf"):GetLabelBackgroundColor(labelCount)
				label.Visible = true
				label.Parent = pages.serverRanks
			end
		end

		--Canvas Size
		pages.serverRanks.CanvasSize = UDim2.new(0, 0, 0, labelCount * templates.admin.AbsoluteSize.Y)
	end)()
end
