return {
["BRITISH ARMY PERSONNEL"] = {
GroupId = 17134656, -- The regiment's group Id
MinRank = 1, -- The minimum rank for the regiment to show up above the user's head. DO NOT set this to 0.
},
["ARMY AIR CORPS"] = {
GroupId = 32667926, -- The regiment's group Id
MinRank = 1, -- The minimum rank for the regiment to show up above the user's head. DO NOT set this to 0.
},
["ARMY HEADQUARTERS"] = {
GroupId = 17134656, -- The regiment's group Id
MinRank = 22, -- The minimum rank for the regiment to show up above the user's head. DO NOT set this to 0.
UseRankNames = false, -- Should the regiment frame show their rank or the regiment's name?
RequireTeam = false, -- Should this regiment only be visible if the player is on the regiment's team?
Team = {
"ARMY AIR CORPS", "ARMY HEADQUARTERS", "BRITISH ARMY PERSONNEL", "CIVILIAN",
"EDUCATION AND TRAINING SERVICES", "FOREIGN RELATIONS", "MODERATION & PATROL",
"PRISON", "RAIDERS", "ROYAL GRENADIER GUARDS", "ROYAL INTELLIGENCE CORPS",
"ROYAL MEDICAL CORPS", "ROYAL MILITARY POLICE", "UNITED KINGDOM SPECIAL FORCES"
}, -- The team that the regiment shows on if RequireTeam is turned on
Color = Color3.new(0, 0, 0), -- The color of the frame
Image = "rbxassetid://18630163150" -- The image next to the frame (optional)
},
}
--[[
Harmony | f_irmware
7/24/2024
]]
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UI = script.Overhead
local Config = require(script.Configuration)
local Regiments = require(script.Regiments)
Players.PlayerAdded:Connect(function(player: Player)
player.CharacterAdded:Connect(function(char: Model)
char:WaitForChild("Humanoid").DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
local GUI = UI:Clone()
GUI.MaxDistance = Config.MaxStuds
GUI.Username.Text, GUI.UShadow.Text = player.Name, player.Name
GUI.Rank.Text, GUI.RShadow.Text = player:GetRoleInGroup(Config["GroupId"]), player:GetRoleInGroup(Config["GroupId"])
RunService.Stepped:Wait()
GUI.Parent = char.Head
for divname, divdata in Regiments do
if (player:GetRankInGroup(divdata["GroupId"]) >= divdata["MinRank"]) then
if not ((divdata["RequireTeam"]) and not (table.find(divdata["Team"], player.Team.Name))) then
if divdata["UseRankNames"] then
GUI.Reg.Text, GUI.REGShadow.Text = player:GetRoleInGroup(divdata["GroupId"]), player:GetRoleInGroup(divdata["GroupId"])
else
GUI.Reg.Text, GUI.REGShadow.Text = divname, divname
end
GUI.Frame.BackgroundColor3 = divdata["Color"]
GUI.Frame.ImageLabel.Image = divdata["Image"]
end
end
end
end)
end)
Your regiment module is lacking a vast amount of data in two other entries. The script you sent just allows you to nearly slip by as indexing these non-existent entries does not result in an error, but nil. nil is falsy, so the conditionals interpret them as false.
table.find(divdata["Team"], player.Team.Name)
Won’t get away with this though, as you’d end up with:
table.find(nil, player.Team.Name)
This will throw an error. You need to add the missing entries in your regiments module
Writing this, then going on to patiently diagnose and explain the problem, makes you some kind of saint.
Just to add, it seems odd to me that one could build so much of a game yet become stumped by the bug of passing in nil instead of a defined table. I’m guessing that this project is not making use of original assets and familiar code. I’d strongly suggest pursuing your projects from the ground up and building everything yourself. You’ll run into a million bugs, but each one will help make you a more proficient dev.