Bug in requiring a module

So for some reason, there is this bug for only about 30% of the people playing the game.
Here is a gif sent to me about the bug:
https://gyazo.com/9bba41419f0a9142368cc4c470cac120
Basically nothing in the UI works, here is the error:
https://gyazo.com/5c9ce61f1a226498377d3d02ff0593c2
Script:

if CurrentRank < 255 then
	landingui.Player_Info.Current_Rank.Image = RanksImages[Player:GetRankInGroup(4972535)]
	landingui.Player_Info.Next_Rank.Image = RanksImages[NextRank]
	landingui.Player_Info.Next_Rank.Next.Text = NextRankInfo
	landingui.Player_Info.Current_Rank.Current.Text = Player:GetRoleInGroup(4972535)
end

“RanksImages” is a module that returns the icon for all role IDs in the group.

local images = {
	

	--[nil] = "http://www.roblox.com/asset/?id=4339428344";
	[0] = "http://www.roblox.com/asset/?id=4339428344";
	[1] = "http://www.roblox.com/asset/?id=4339428344";
	[2] = "http://www.roblox.com/asset/?id=4339428344";
	[3] = "http://www.roblox.com/asset/?id=4898608712";
	[4] = "http://www.roblox.com/asset/?id=4898608013";
	[5] = "http://www.roblox.com/asset/?id=4898607761";
	[6] = "http://www.roblox.com/asset/?id=4898608847";
	[7] = "http://www.roblox.com/asset/?id=4898608955";
	[9] = "http://www.roblox.com/asset/?id=4898608955";
	[10] = "http://www.roblox.com/asset/?id=4898609249";
	[11] = "http://www.roblox.com/asset/?id=4898609094";
	[12] = "http://www.roblox.com/asset/?id=4898608117";
	[13] = "http://www.roblox.com/asset/?id=4898607538";
	[14] = "http://www.roblox.com/asset/?id=4898608531";
	[16] = "http://www.roblox.com/asset/?id=4898608245";
	[17] = "http://www.roblox.com/asset/?id=4898607634";
	[18] = "http://www.roblox.com/asset/?id=4898607634";
	[19] = "http://www.roblox.com/asset/?id=4898607365";
	[20] = "http://www.roblox.com/asset/?id=4898608627";
	[22] = "http://www.roblox.com/asset/?id=4898608385";
	[23] = "http://www.roblox.com/asset/?id=4898607919"
}

return images

What bothers me is that only some of the players have that bug…
I am pretty inexperienced with modules so I would be very glad to receive an answer.

Thank you for your time :slight_smile:

this is the required module, and not the ModuleScript object right?

what’s NextRank ?
Could you share the relevant portion of the script?


By the way you can just use rbxassetid instead of the entire url:
"rbxassetid://4339428344"

That’s right. (30 charsssssss)

Relevant Portion of script:

function FindRankInfo(GroupInfo,Rank,Role)
	if Rank < 255 then
		for i,v in pairs(GroupInfo.Roles) do
			if v.Rank == Rank then
				return v.Name
			end
			if i == #GroupInfo.Roles then
				return "NOT AVAILABLE"
			end
		end
	end
end




--// Player Information
local GetInfo = Player:GetRoleInGroup(4972535)
local CurrentRank = Player:GetRankInGroup(4972535)
local PreviousRank = tonumber(CurrentRank) - 1 --it works in reverse, somehow..
local NextRank = tonumber(CurrentRank) + 1
local GroupInfo  = GroupService:GetGroupInfoAsync(4972535)
local PreviousRankInfo = FindRankInfo(GroupInfo,PreviousRank,GetInfo)
local NextRankInfo = FindRankInfo(GroupInfo,NextRank,GetInfo)
local RanksImages = require(game.ReplicatedStorage.RankImages)

script.Parent.Landing.Player_Info.Player_Icon.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&userId=" .. game.Players.LocalPlayer.UserId
playerinfo.NameText.Text = Player.Character.Name


if CurrentRank < 255 then
	landingui.Player_Info.Current_Rank.Image = RanksImages[Player:GetRankInGroup(4972535)]
	landingui.Player_Info.Next_Rank.Image = RanksImages[NextRank]
	landingui.Player_Info.Next_Rank.Next.Text = NextRankInfo
	landingui.Player_Info.Current_Rank.Current.Text = Player:GetRoleInGroup(4972535)	
elseif CurrentRank == 255 then
	landingui.Player_Info.Current_Rank.Image = RanksImages[Player:GetRankInGroup(4972535)]
	landingui.Player_Info.Current_Rank.Current.Text = Player:GetRoleInGroup(4972535)	
	landingui.Player_Info.Next_Rank.Next.Text = "No Next Rank"
else
    landingui.Player_Info.Current_Rank.Image = RanksImages[Player:GetRankInGroup(4972535)]
	landingui.Player_Info.Current_Rank.Current.Text = Player:GetRoleInGroup(4972535)	
	landingui.Player_Info.Next_Rank.Next.Text = "[REC] Recruit"
end```