Help with checking rank system

local function ranked(player)
	for i, p in pairs(Ranks) do
		wait()
		for _, v in pairs(Ranks[i]) do
			wait()
			if v == player.Name then
				return true --Returns true if they have a rank
			end
		end
	end
	return false --Returns false if they do not
end

You could then do:

	elseif not ranked(Player) then
		table.insert(Ranks.NoRank, Player.Name)
		return nil
	end

Wait but Ranks are all the ranks allowed ranks are the ranks that can use the commands.

local Ranks = { --All the ranks in the admin
	["Owner"] = {"FreeFlyHaker56"};
	["Co-Owner"] = {};
	["SuperAdmin"] = {};
	["Admin"] = {};
	["Mod"] = {};
	["NoRank"] = {};
}

local allowedRanks = { --Used to check if they can use commands
	"Owner";
	"Co-Owner";
	"SuperAdmin";
	"Admin";
	"Mod";
}

Is it checking if they are a rank?

Yes so when you call the function you do isPlayerAllowed("Mod", Player) and it will only continue on through the script if the player is at least a mod

Is it working the way you want it to?

1 Like

Wait I am fixing 2 things at once my command is broken and the ranks

1 Like

I deleted the isPlayerAllowed function

1 Like

Ok I’m sorry I think I misunderstood what you wanted it to do