Module not returning anything

Yep, we have this once again.
My module is having issues, it’s not returning anything.
I did somewhat like this.
It’s going to see if the player’s rank is above the rank required.
My dictionaries:

local AdminList = {
	{"Creator", {}, {10}},
	{"Owner", {}, {9}},
	{"Head Administrator", {}, {8}},
	{"Super Administrator", {}, {6}},
	{"Administrator", {}, {5}},
	{"Head Moderator", {}, {4}},
	{"Senior Moderator", {}, {3}},
	{"Moderator", {}, {2}},
	{"VIP", {}, {1}},
	-- last one would be guest. ranking would be 0.
}
local Staff = {
	{"Holder", {"Obj_ective"}, {10}},
	{"Head Administrator", {}, {8}},
	{"Administrator", {}, {6}},
	{"Head Moderator", {}, {5}},
	{"Moderator", {}, {3}},
	{"Trial Administrator", {}, {2}},
	{"Trial Moderator", {}, {2}},
}

My Function:

function SyC:IsPlayerAboveRequired(username,rankrequired)
  for i,v in pairs(Staff) do
    for _,_2 in pairs(v) do
      if type(_2) == 'number' then
        -- number
      elseif type(_2) == 'string' then
        print('S.2')
        if _2 == rankrequired then
          print('S.3')
        elseif _2 ~= rankrequired then
          print('S.1')
        end
      elseif type(_2) == 'table' then
        for _,_1 in pairs(_2) do
          if _1 == username then
            -- boom
            for _,_9141 in pairs(v[2]) do
              if _9141 == _1 then
                for _,_3 in pairs(Staff) do
                  if _3[1] == rankrequired then
                    if _3[3][1] > v[3][1] then
                      print('S1')
                      return(false)
                    else

                      if v[3][1] > _3[3][1] then
                        print('S2')
                        return(true)
                      else
                        if _3[3][1] == v[3][1] then
                          print('S3')
                          return(true)
                        else
                          for i,n in pairs(AdminList) do
                            if n[1] == rankrequired then
                              if v[3][1] > n[3][1] then
                                print('S4')
                                return(true)
                              else
                                if n[3][1] > v[3][1] then
                                  print('S5')
                                  return(false)
                                else
                                  if v[3][1] == n[3][1] then
                                    print('S6')
                                    return(true)
                                  else
                                    for _,_p in pairs(AdminList) do
                                      print'S7'
                                      if _p[1] == rankrequired then
                                        for _,_z in pairs(_p) do
                                          if type(_z) == 'number' then
                                            -- number
                                          elseif type(_z) == 'string' then
                                            -- rank name
                                          elseif type(_z) == table then
                                            for _,_M in pairs(_z) do
                                              if _M == username then
                                                -- boom
                                                if _p[2][_M] then
                                                  return(true)
                                                else
                                                  for i,b in pairs(AdminList) do
                                                    if b[2][_M] then
                                                      for _,_99 in pairs(AdminList) do
                                                        if _99[1] == rankrequired then
                                                          if b[3][1] > _99[3][1] then
                                                            return(true)
                                                          else
                                                            if b[3][1] == _99[3][1] then
                                                              return(true)
                                                            else
                                                              if _99 > b[3][1] then
                                                                return(false)
                                                              end
                                                            end
                                                          end
                                                        end
                                                      end
                                                    end
                                                  end
                                                end
                                              end
                                            end
                                          end
                                        end
                                      end
                                    end
                                  end
                                end
                              end
                            end
                          end
                        end
                      end
                    end
                  end
                end

              end
            end
          end
        end
      end
    end
  end
end

Sorry if my code is messy.
Anyways, my code is not returning to the specific arguements i’m giving it.

print(MODULE:IsPlayerAboveRequired('Obj_ective','Administrator')) -- Success
wait(1)
print(MODULE:IsPlayerAboveRequired('Obj_ective','Moderator')) -- Success
wait(2)
print(MODULE:IsPlayerAboveRequired('Obj_ective','VIP')) -- Failure(Didn't return anything.)

I’m trying to get a solution to this problem.
I have tested with print.
It isn’t reaching S2 for the failure.
For the rest, they are reaching S2.
I tried printing, and it seems like the one thats failing isn’t reaching S2. it’s only reaching S.1 and S.2
I also tried investigating my module, I failed to find a solution to this.

1 Like

Please don’t post the same threads again and again, just reply to the original topic, you’ve done this 3 times! Sometimes you just need to rewrite the script to understand what’s wrong. In addition please properly format your code so it’s easier to read and debug, it’s tedious to figure out what is doing what in your script.


Just a note, if this reply sounds a bit harsh (so sorry if it is) it’s just because I couldn’t think of a better way to reword it.

Even if I post the same thread again and again, it’s gonna be a new issue.
I’m kind of new to devforum, and so since a new issue appeared I had to post this thread again, but with a new issue because it’s hard to debug.
Rewriting the script will be waste, sorry.
If I rewrite the script with the hard work I had done so much for that function, it’d be a hard time rewriting it.
I intend to fix every error in my scripts, but since these are difficult to figure out, I post on devforum. It’s the only way I really fix these issues.

You can use a beautifier so it’s much easier for people to read your code.

2 Likes

Post updated. Thanks for the beautifier!