Pulling GroupId from moduleScript

20 views Asked by At

I'm working on a Roblox overhead GUI and I'm using a moduleScript for the values. It currently pulls a random value of its liking instead of abiding to the parameters.

The (relevant) part of the script executing:

local userRankInGroup = plr:GetRankInGroup(32494019)
        
        for _, division in pairs(config) do
            local groupIdToCheck = division["Group Id"]
            if userRankInGroup and userRankInGroup >= division["Minimum RankId"] and userRankInGroup <= division["Maximum RankId"] then
                clonedUI.DivRank.Text = division["Regiment Name"]
                clonedUI.DivRankShadow.Text = division["Regiment Name"]
                clonedUI.regimentFrame.regimentIcon.Image = division["Image Id"]
                clonedUI.regimentFrame.BackgroundColor3 = division["Regiment Color"]
                print("Overhead GUI for".. plr .."has loaded successfully.")
                break
                else 
            end
        end 

The moduleScript:

local regiments = {
    
    
    ["Office of The Inspector General"] = {
        ["Regiment Name"] = "OIG",
        ["Group Id"] = 32921091,
        ["Image Id"] = "http://www.roblox.com/asset/?id=14412072617",
        ["Regiment Color"] = Color3.new(0.435294, 0.372549, 0.0117647),
        ["Minimum RankId"] = 5,
        ["Maximum RankId"] = 250,
        
    },
    
    
    ["Naval Special Warfare Command"] = {
        ["Regiment Name"] = "NSWC",
        ["Group Id"] = 32954415,
        ["Image Id"] = "http://www.roblox.com/asset/?id=15186922222",
        ["Regiment Color"] = Color3.new(0.129412, 0.129412, 0.129412),
        ["Minimum RankId"] = 5,
        ["Maximum RankId"] = 250,

    },

        }
        
    
return regiments

I tried pulling local userRankInGroup = plr:GetRankInGroup(32494019) down after if userRankInGroup and userRankInGroup >= division["Minimum RankId"] and userRankInGroup <= division["Maximum RankId"] then as I think that's where the problem lies. But then it just didn't return any value and just gave me the blank option.

0

There are 0 answers