How can i get a users admin level using adonis, either client or server

I need this since i want to assign chat tags to staff members, but i do not want a manual table of all staff members, i want to use adonis methods, aside from server plugins, to automatically assign an “AdminLevel” number attribute (which is their admin level)

Would anybody know how to do this?

If you would like to get the Adonis admin level of any user, you may use the GetLevel method of the Adonis’ _G API.

To enable the _G API and be able to use it: in your Adonis loader, head to the Settings module script, and set settings.G_API to true.

Once that’s enabled, use this snippet:

_G.Adonis.GetLevel(PLAYER)

to get the given player’s Admin level number.

For instance, if I wanted to get mine, I would do:

_G.Adonis.GetLevel(game.Players.safeLast120)

I have already tries this
I enabled everything
had G_ACCESS false
and even then
it gave a nil error on a client script
and gave _G.Adonis not found

even when i did a repeat task.wait() until _G.Adonis

Creating a server plugin through Adonis, which you’ll have to find out how to do if you don’t already know, then using the function stored in server.Admin, GetLevel, should return both the admin level and the rank of a user.

You’d have to pass in a Player Instance though if I remember correctly into that function.

So in example, to retrieve the admin level and rank of a player in-game:

local Players = service.Players

local Admin = server.Admin

--// Replace the value stored here with the target Player
local player = Players:GetPlayers()[1]

local level: number, rank: string = Admin.GetLevel(player)

print(level) --// Outputs the numeric value representing the level
print(rank) --// Outputs the name of the rank the user currently is classified under

Hopefully this helps, however I haven’t tested anything myself - this is purely off of what I can remember about Adonis.

Also, I’d recommend not using Adonis’s _G API interface as your method of interacting with Adonis, as I’ve been told that it is not as secure as using plugins, personally. Additionally, using plugins in my opinion, is much easier to understand.

The choice is yours, however if you wish to do this through _G, I’m afraid I’ve forgotten almost everything I once knew about it.

Yes, it will error in the client unless you specify in the loader config module that you want it available in the client, like so:


Server remains untouched.

Apologies for not specifying that bit.