Adonis Custom Level Issue

Hey. I’ve made a custom level in my adonis settings, for AdminLevel:50
But I want to know how I can give this admin to other players via chat.

Example:
:trainer [USER] – Give the specified user AdminLevel:50 (trainer commands)

Here is my Custom Rank:
image

Help would be greatly appreciated, Thanks.

Hey! You would have to make a custom command in the MainModule of Adonis to make this work.

Can you like give me the code, I am unexperienced in modules and i dont understand any of the things in there.

Alright. Use the following loader: https://create.roblox.com/marketplace/asset/7510622625/Adonis-Admin-Loader-Epix-Incorporated

Use the following module: https://create.roblox.com/marketplace/asset/7510592873/Adonis-MainModule

After you have imported both, put the MainModule inside the Loader script. Then in the loader, on line 161, change the value of the “module” variable to “require(script.MainModule)”
image
Then, go into the MainModule > Server > Commands and open the Moderators module. Then before the “Kick” command, paste in the following code.

Trainer= { Prefix = Settings.Prefix; Commands = {"permtrainer", "ptrainer", "trainer"}; Args = {"player/user"}; Description = "Makes the target player(s) a trainer; saves"; AdminLevel = "Moderator"; --Change this to the minimum rank that can set the Trainer the correct permissions. Function = function(plr: Player, args: {string}, data: {any}) local senderLevel = data.PlayerData.Level for _, v in service.GetPlayers(plr, assert(args[1], "Missing target player (argument #1)"), { UseFakePlayer = true; }) do if senderLevel > Admin.GetLevel(v) then Admin.AddAdmin(v, "Trainer") Functions.Notification("Notification", "You are a Trainer. Click to view commands.", {v}, 10, "MatIcons://Shield", Core.Bytecode("client.Remote.Send("ProcessCommand","{Settings.Prefix}cmds")")) Functions.Hint("{service.FormatPlayer(v, true)} is now a Trainer", {plr}) else Functions.Hint("{service.FormatPlayer(v, true)} is already the same admin level as you or higher", {plr}) end end end };
Let me know if it works.

Main adonis didn’t even load. But I think its cuz when I copied ur code and pasted it in all of the code was on 1 line, and I don’t know where to go on another line

Trainer= { Prefix = Settings.Prefix; Commands = {"permtrainer", "ptrainer", "trainer"}; Args = {"player/user"}; Description = "Makes the target player(s) a trainer; saves"; AdminLevel = "Moderator"; --Change this to the minimum rank that can set the Trainer the correct permissions. Function = function(plr: Player, args: {string}, data: {any}) local senderLevel = data.PlayerData.Level for _, v in service.GetPlayers(plr, assert(args[1], "Missing target player (argument #1)"), { UseFakePlayer = true; }) do if senderLevel > Admin.GetLevel(v) then Admin.AddAdmin(v, "Trainer") Functions.Notification("Notification", "You are a Trainer. Click to view commands.", {v}, 10, "MatIcons://Shield", Core.Bytecode("client.Remote.Send("ProcessCommand","{Settings.Prefix}cmds")")) Functions.Hint("{service.FormatPlayer(v, true)} is now a Trainer", {plr}) else Functions.Hint("{service.FormatPlayer(v, true)} is already the same admin level as you or higher", {plr}) end end end };

As you can see, all your code just becomes 1 line for some reason


Here is the image which shows linebreaks

Okay I will try writing it. I will give u an update when its done.

Does this look right?

Trainer = {
			Prefix = Settings.Prefix;
			Commands = {"permtrainer", "ptrainer", "trainer"};
			Args = {"player/user"};
			Description = "Grant trainer perms to the specified player.; saves;";
			AdminLevel = "Moderators";
			
			Function = function(plr: Player, args: {string}, data: {any})
				local senderLevel = data.PlayerData.Level
				
				for _, v in service.GetPlayers(plr, assert(args[1], "Missing target player (argument #1)"), {
				UseFakePlayer = true;
				})
				do
					if senderLevel > Admin.GetLevel(v) then
						Admin.AddAdmin(v, "Trainer")
						Functions.Notification("Notification", "You are a trainer. Click to view commands.", {v}, 10, "MatIcons://Shield", Core.Bytecode(`client.Remote.Send('ProcessCommand',' {Settings.Prefix}cmds')`))
						Functions.Hint(`{service.FormatPlayer(v, true)} is now a trainer`, {plr})
					else
						Functions.Hint(`{service.FormatPlayer(v, true)} is aeady the same admin level as you or higher.`, {plr})
					end
				end
			end
		};

Gonna test right now

Looks right. chartacttetrtetcyastctstd

IT WORKS!!!

Thank you man. Whilst I have you, is there a way to make this a temp trainer cuz i dont want the player to have it forever, just have it for like 6 hours at a time? (If this is too complex, i totally understand)

It is possible. I can send that over as well if you would like.

TempTrainer = { Prefix = Settings.Prefix; Commands = {"temptrainer", "ttrainer"}; Args = {"player"}; Description = "Makes the target player(s) a temporary trainer; does not save"; AdminLevel = "Moderators"; -- Change this to minimum rank that can set the Trainer role to someone. Function = function(plr: Player, args: {string}, data: {any}) local senderLevel = data.PlayerData.Level for _, v in service.GetPlayers(plr, assert(args[1], "Missing target player (argument #1)")) do if senderLevel > Admin.GetLevel(v) then Admin.AddAdmin(v, "Trainer", true) Functions.Notification("Notification", "You are a temp trainer. Click to view commands.", {v}, 10, "MatIcons://Shield", Core.Bytecode("client.Remote.Send("ProcessCommand","{Settings.Prefix}cmds")")) Functions.Hint("{service.FormatPlayer(v, true)} is now a temp trainer", {plr}) else Functions.Hint("{service.FormatPlayer(v, true)} is already the same admin level as you or higher", {plr}) end end end };


Here is the right format for it. Quite similarly structured to the normal one.

1 Like

Hello again. Sorry for the delayed response, I will be testing this code as soon as possible. Probably in 30 mins to an hour. Thank you for taking so much time out of your day to help me, I really really appreciate it man :smile:

1 Like

It seems to work perfectly. Thank you Flash. If I may ask, how did you get so good at scripting?
Trying to learn it myself but encounter lots of errors i seem to need the devforum for.

No worries :slight_smile: CHARACETRTERETRETRE

Generally, I learned out of tutorials and source code. I just then adapted to it all. From there, I would generally read a lot of the Documentations for different functions etc.

1 Like

Hey flash. Having another issue. Could you help?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.