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)”
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
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
};
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)
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 };
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
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.
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.