Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Custom adonis command not working. No error output. Why is it happening?

Asked by 2 years ago

Hi. I'm making a setrank command for my game but the command isn't working. Anybody know why this is happening? There's no output in console. Here is my script:

server = nil
service = nil
return function()
    server.Commands.ExampleCommand = {
        Prefix = '!';
        Commands = {"setrank", "setgroup", "settag"};
        Args = {"arg1"};
        Description = "Set group tag.";
        Hidden = false;
        Fun = false;
        AdminLevel = "Players";
        Function = function(plr,args)
            local plrName = plr.Name
            local chr = game.Workspace[plrName]
            local secId = 11597600
            local mainId = 11597498
            local adminId = 11597658

            if tostring(args[1]) == 'rt' or 'main' then
                chr.Head.Rank.Rank.Text = plr:GetRoleInGroup(mainId)
            elseif tostring(args[1]) == 'security' or 'RTST' then
                chr.Head.Rank.Rank.Text = plr:GetRoleInGroup(secId)
            elseif tostring(args[1]) == 'ad' or 'administration' then
                chr.Head.Rank.Rank.Text = plr:GetRoleInGroup(adminId)
            end
        end
    }
end

1 answer

Log in to vote
0
Answered by 2 years ago
  1. You can get character through plr.Character

  2. Optional, but you can/should make a var for the rank, ex:

local rank = chr.Head.Rank.Rank
  1. I'm not sure if this is intentional or not but it might be
chr.Head.Rank.Text
--instead of
chr.Head.Rank.Rank.Text

If 3 doesn't help then add me on discord: Shiba#5586 and I can help more

P.S. In the answer section I wrote 3. but it shows up as 1. ;/

0
Resolved in dms, was parenting to head incorrectly. OwOShiba 78 — 2y
Ad

Answer this question