Help with Scirpt

Hello Developers, I have a script that will print all the player’s name in a certain team but I want to advance and make it print all player’s name in a certain group rank of higher, how can I do that?

local function Log()
	
	local Staff = {}
	
	local Team = game:GetService("Teams")

	local TeamName = M_["Team"]
		
		for _,v in pairs(Team[TeamName]:GetPlayers()) do 
			
		table.insert(Staff, v.Name)

		
		local StaffLog = table.concat(Staff, ", ")
		
		print(StaffLog)

		
	end
	
end

I don’t know if you can get every member of the group, but you certainly can use the player function GetRankInGroup(group_id) to know the player rank.
GetRankInGroup: Player | Roblox Creator Documentation