Converting Usernames to UserIDs in a table

Hello, recently I have been trying to make a permission system for admin commands. The player taking the model must enter their / others usernames into a table. I am still trying to figure out how I would convert the Usernames in the table to UserIds. I do not know if that is needed but it seems safer.

The table:

Ranks = {			
	{5, "Owner",		};
	{4, "HeadAdmin",	{"Davide_24", "Another Name"},  };		
	{3, "Admin",		{"Name Here", "Another Name"},  };
	{2, "Moderator",	{"Name Here", "Another Name"},  };
	{1, "VIP",			{"Name Here", "Another Name"},  };
	{0, "None",			};

}


local Module = require(game.ServerScriptService.AdminCommands)
Module:Initialize(Ranks)

I have tried using this (errors with nil value):

local Module = require(script.Parent)
wait(0.5)

local Headadmins = Module.adminList[2][3]
local Admins = Module.adminList[3][3]
local Moderators = Module.adminList[4][3]
local VIPs = Module.adminList[5][3]

local HeadAdminIDs = {}
local AdminIDs = {}
local ModIDs = {}
local VIPIDs = {}

for i = 1, #Headadmins do
	local HeadAdmins2 = pcall(Headadmins[i]:GetUserIdFromNameAsync())
	HeadAdminIDs.insert(HeadAdmins2)
	print(HeadAdminIDs)
end

I hope someone can help me with this as I had this problem for a long time now. This is my first time using tables.

The module only relais the information the Server script.

Please consider having a different structure (such as string-based key + value pairs for your rank priorities and actual usernames) for your admin table. Storing usernames for long-term use is also not suggested and UserId’s should be used by default. Your utilization of GetUserIdFromNameAsync suggests you are method calling a number which is not possible. The proper way to do it would be like this:

for i, username in ipairs(Headadmins) do
	local userid = game:GetService("Players"):GetUserIdFromNameAsync(username)
	Headadmins[i] = userid
end