You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to make this overhead UI script display the Rank in certain division groups instead of the name of the division. (different teams should display different group’s ranks.) - What is the issue? Include screenshots / videos if possible!
I’m not sure how to achieve this, I’m pretty lost.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried sticking in a few bits of code here and there but nothing’s really working. (I also tried ChatGPT since I was desperate… won’t do that again.)
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
----------------------------------------------------------------- Roblox Services
local PlayerService = game:GetService('Players');
local ServerScriptService = game:GetService('ServerScriptService');
local GroupService = require(ServerScriptService:FindFirstChild('ExtendedGroupService'));
local MarketService = game:GetService('MarketplaceService')
local UserInputService = game:GetService("UserInputService");
----------------------------------------------------------------- Game Storage
local ReplicatedStorage = game:GetService('ReplicatedStorage');
----------------------------------------------------------------- Script Storage
local RankUI = script:FindFirstChild('RankUI')
----------------------------------------------------------------- Configuration
local Overhead = {
GroupLinked = true,
GroupId = 32946424,
DefaultRank = "Civilian", -- Rank displayed for players not in the group.
TeamDisplayed = true,
DisplayedTeams = {"Army Special Operations Command","Military Police","Training & Doctrine Command","Forces Command"},
GroupDivisions = true,
DivisionsOverTeam = true, -- Should the division display override the team display?
Divisions = {
-- 32948161 mp
{
id = 0, -- GroupID
commandGroup = {id = 0, minRank = 255}, -- Group that oversses this division + the minimum rank required for this not to be shown
displayname = "US Army Special Operations Command", -- What it will be displayed as
displaycolor = Color3.fromRGB(0, 0, 0) -- What color the text will be
},
{
id = 32948161, -- GroupID
commandGroup = {id = 0, minRank = 1}, -- Group that oversses this division + the minimum rank required for this not to be shown
displayname = "Military Police", -- What it will be displayed as
displaycolor = Color3.fromRGB(0, 0, 0) -- What color the text will be
},
{
id = 0, -- GroupID
commandGroup = {id = 0, minRank = 90}, -- Group that oversses this division + the minimum rank required for this not to be shown
displayname = "75th Ranger Regiment", -- What it will be displayed as
displaycolor = Color3.fromRGB(126, 104, 63) -- What color the text will be
},
{
id = 0, -- GroupID
commandGroup = {id = 0, minRank = 90}, -- Group that oversses this division + the minimum rank required for this not to be shown
displayname = "Army Special Forces", -- What it will be displayed as
displaycolor = Color3.fromRGB(39, 70, 45) -- What color the text will be
},
{
id = 0, -- GroupID
commandGroup = {id = 0, minRank = 90}, -- Group that oversses this division + the minimum rank required for this not to be shown
displayname = "160th Special Operations Aviation Regiment", -- What it will be displayed as
displaycolor = Color3.fromRGB(0, 32, 91) -- What color the text will be
},
{
id = 0, -- GroupID
commandGroup = {id = 0, minRank = 255}, -- Group that oversses this division + the minimum rank required for this not to be shown
displayname = "[Media Team]", -- What it will be displayed as
displaycolor = Color3.fromRGB(73, 27, 159) -- What color the text will be
},
{
id = 0, -- GroupID
commandGroup = {id = 0, minRank = 6}, -- Group that oversses this division + the minimum rank required for this not to be shown
displayname = "1st Infantry Division", -- What it will be displayed as
displaycolor = Color3.fromRGB(107, 95, 0) -- What color the text will be
},
{
id = 0, -- GroupID
commandGroup = {id = 0, minRank = 6}, -- Group that oversses this division + the minimum rank required for this not to be shown
displayname = "1st Cavalry Division", -- What it will be displayed as
displaycolor = Color3.fromRGB(245, 205, 48) -- What color the text will be
},
{
id = 0, -- GroupID
commandGroup = {id = 0, minRank = 6}, -- Group that oversses this division + the minimum rank required for this not to be shown
displayname = "1st Armored Division", -- What it will be displayed as
displaycolor = Color3.fromRGB(245, 200, 66) -- What color the text will be
},
{
id = 0, -- GroupID
commandGroup = {id = 0, minRank = 6}, -- Group that oversses this division + the minimum rank required for this not to be shown
displayname = "101st Airborne Division", -- What it will be displayed as
displaycolor = Color3.fromRGB(245, 186, 0) -- What color the text will be
},
{
id = 0, -- GroupID
commandGroup = {id = 0, minRank = 6}, -- Group that oversses this division + the minimum rank required for this not to be shown
displayname = "82nd Airborne Division", -- What it will be displayed as
displaycolor = Color3.fromRGB(237, 130, 47) -- What color the text will be
},
{
id = 0, -- GroupID
commandGroup = {id = 0, minRank = 6}, -- Group that oversses this division + the minimum rank required for this not to be shown
displayname = "3rd Infantry Division", -- What it will be displayed as
displaycolor = Color3.fromRGB(3, 127, 252) -- What color the text will be
},
{
id = 0, -- GroupID
commandGroup = {id = 0, minRank = 13}, -- Group that oversses this division + the minimum rank required for this not to be shown
displayname = "Special Reaction Team", -- What it will be displayed as
displaycolor = Color3.fromRGB(135, 123, 68) -- What color the text will be
},
{
id = 0, -- GroupID
commandGroup = {id = 0, minRank = 13}, -- Group that oversses this division + the minimum rank required for this not to be shown
displayname = "Criminal Investigation Division", -- What it will be displayed as
displaycolor = Color3.fromRGB(135, 123, 68) -- What color the text will be
},
{
id = 0, -- GroupID
commandGroup = {id = 0, minRank = 13}, -- Group that oversses this division + the minimum rank required for this not to be shown
displayname = "Military Security Unit", -- What it will be displayed as
displaycolor = Color3.fromRGB(135, 123, 68) -- What color the text will be
},
{
id = 0, -- GroupID
commandGroup = {id = 0, minRank = 13}, -- Group that oversses this division + the minimum rank required for this not to be shown
displayname = "Fort Protection Unit", -- What it will be displayed as
displaycolor = Color3.fromRGB(135, 123, 68) -- What color the text will be
},
{
id = 0, -- GroupID
commandGroup = {id = 0, minRank = 230}, -- Group that oversses this division + the minimum rank required for this not to be shown
displayname = "Army Medical Command", -- What it will be displayed as
displaycolor = Color3.fromRGB(248, 248, 248) -- What color the text will be
},
},
SetableTags = true,
Tags = {
{
id = "KOS", -- Used in the chat command & indexing [UNIQUE]
display = "Wanted - KOS", -- Text of the tag
color = Color3.fromRGB(230, 37, 63), -- Color of the displayed tag
teams = {"Military Police","Army Command"} -- Teams that can apply this tag to players or themselves
},
{
id = "AOS", -- Used in the chat command & indexing [UNIQUE]
display = "Wanted - AOS", -- Text of the tag
color = Color3.fromRGB(230, 37, 63), -- Color of the displayed tag
teams = {"Military Police","Army Command"} -- Teams that can apply this tag to players or themselves
},
{
id = "CLR", -- Used in the chat command & indexing [UNIQUE]
display = "Authorized", -- Text of the tag
color = Color3.fromRGB(37, 230, 85), -- Color of the displayed tag
teams = {"Military Police","Army Command"} -- Teams that can apply this tag to players or themselves
},
{
id = "CLRLETHAL", -- Used in the chat command & indexing [UNIQUE]
display = "Authorized/Armed", -- Text of the tag
color = Color3.fromRGB(255, 140, 0), -- Color of the displayed tag
teams = {"Military Police","Army Command"}
},
{
id = "ALLY", -- Used in the chat command & indexing [UNIQUE]
display = "Allied", -- Text of the tag
color = Color3.fromRGB(237, 191, 40), -- Color of the displayed tag
teams = {"Military Police","Army Command"}
},
{
id = "BCTCLR", -- Used in the chat command & indexing [UNIQUE]
display = "BCT CLEARED", -- Text of the tag
color = Color3.fromRGB(37, 230, 85), -- Color of the displayed tag
teams = {"Military Police","Army Command","Training & Doctrine Command"}
},
{
id = "BCTREVOKE", -- Used in the chat command & indexing [UNIQUE]
display = " ", -- Text of the tag
color = Color3.fromRGB(255, 255, 255), -- Color of the displayed tag
teams = {"Military Police","Army Command","Training & Doctrine Command"}, -- Teams that can apply this tag to players or themselves
disableothers = true
},
{
id = "VIP", -- Used in the chat command & indexing [UNIQUE]
display = "Special Access", -- Text of the tag
color = Color3.fromRGB(237, 191, 40), -- Color of the displayed tag
teams = {"Army Command","Military Police"} -- Teams that can apply this tag to players or themselves
},
{
id = "ALLIEDLEADER", -- Used in the chat command & indexing [UNIQUE]
display = "Allied Leader", -- Text of the tag
color = Color3.fromRGB(252, 215, 3), -- Color of the displayed tag
teams = {"Army Command","Military Police"} -- Teams that can apply this tag to players or themselves
},
{
id = "REVOKE", -- Used in the chat command & indexing [UNIQUE]
display = " ", -- Text of the tag
color = Color3.fromRGB(255, 255, 255), -- Color of the displayed tag
teams = {"Military Police","Army Command"}, -- Teams that can apply this tag to players or themselves
disableothers = true -- With this tag be used for the purpose of removing the other tags?
},
{
id = "REVOKEPASS", -- Used in the chat command & indexing [UNIQUE]
display = "Access Revoked", -- Text of the tag
color = Color3.fromRGB(255, 35, 38), -- Color of the displayed tag
teams = {"Military Police","Army Command"}, -- Teams that can apply this tag to players or themselves
disableothers = true -- With this tag be used for the purpose of removing the other tags?
},
{
id = "DEV", -- Used in the chat command & indexing [UNIQUE]
display = "Cool Developer", -- Text of the tag
color = Color3.fromRGB(0, 255, 255), -- Color of the displayed tag
teams = {"Army Command"}, -- Teams that can apply this tag to players or themselves
disableothers = true -- With this tag be used for the purpose of removing the other tags?
},
{
id = "IRL", -- Used in the chat command & indexing [UNIQUE]
display = "Real Life Military", -- Text of the tag
color = Color3.fromRGB(255, 226, 0), -- Color of the displayed tag
teams = {"Army Command"}, -- Teams that can apply this tag to players or themselves
disableothers = true -- With this tag be used for the purpose of removing the other tags?
},
{
id = "COOL", -- Used in the chat command & indexing [UNIQUE]
display = "Cool Kid", -- Text of the tag
color = Color3.fromRGB(255, 0, 255), -- Color of the displayed tag
teams = {"Army Command"}, -- Teams that can apply this tag to players or themselves
disableothers = true -- With this tag be used for the purpose of removing the other tags?
},
{
id = "BIRTHD", -- Used in the chat command & indexing [UNIQUE]
display = " 🎉 Birthday 🎂", -- Text of the tag
color = Color3.fromRGB(0, 85, 255), -- Color of the displayed tag
teams = {"Army Command"}, -- Teams that can apply this tag to players or themselves
disableothers = true -- With this tag be used for the purpose of removing the other tags?
},
{
id = "NOOB", -- Used in the chat command & indexing [UNIQUE]
display = "Noob", -- Text of the tag
color = Color3.fromRGB(251, 255, 0), -- Color of the displayed tag
teams = {"Army Command"}, -- Teams that can apply this tag to players or themselves
disableothers = true -- With this tag be used for the purpose of removing the other tags?
},
{
id = "CENTCOM", -- Used in the chat command & indexing [UNIQUE]
display = "CENTCOM", -- Text of the tag
color = Color3.fromRGB(251, 255, 0), -- Color of the displayed tag
teams = {"Army Command"}, -- Teams that can apply this tag to players or themselves
disableothers = true -- With this tag be used for the purpose of removing the other tags?
},
{
id = "COLOR", -- Used in the chat command & indexing [UNIQUE]
gamepassID = 4681529,
setcolor = false -- With this tag be used for the purpose of removing the other tags?
},
},
CustomDisplayed = true,
CustomOverAll = true,
Customs = {
-- 32946424 main group
{
c_type = 1, -- 1 = Player, 2 = Group, 3 = Team
c_id = 0,-- Player ID, Team Name, or GroupID
c_area = 3, -- 1 = Name, 2 = Rank, 3 = Division, 4 = Name & Rank, 5 = Name & Division
c_display = "Headquarters, United States Army",
c_color = Color3.fromRGB(91, 93, 105)
},
},
}
----------------------------------------------------------------- MiscFunctions
local function FindPlayer(Message)
if Message then
local msg = Message:lower()
for _, v in pairs(game.Players:GetPlayers()) do
local name = v.Name:lower():sub(0, msg:len())
if name == msg then
return v
end
end
return nil
end
return nil
end
local function FindDivision(plr)
for i=1,#Overhead.Divisions do
local Div = Overhead.Divisions[i]
if plr:IsInGroup(Div.id) and plr:GetRankInGroup(Div.id) ~= 255 then
if Div.commandGroup then
if plr:GetRankInGroup(Div.commandGroup.id) >= Div.commandGroup.minRank then return nil end
end
return Div
end
end
return nil
end
local function FindCustom(plr)
for i=1,#Overhead.Customs do
local CustomTag = Overhead.Customs[i]
if CustomTag.c_id == plr.UserId or plr:IsInGroup(tonumber(CustomTag.c_id)) or plr.Team.Name == tostring(CustomTag.c_id) then
return CustomTag
end
end
return nil
end
local function FindTag(id)
for i=1,#Overhead.Tags do
local Tag = Overhead.Tags[i]
if Tag.id == id then
return Tag
end
end
return false
end
local function isTagCommand(msg,plr)
local MsgArguments = string.split(msg," ")
if #MsgArguments > 3 or #MsgArguments == 1 then return false,false end
local LocatedTag = FindTag(string.upper(MsgArguments[1]))
local LocatedTarget = FindPlayer(MsgArguments[2])
if LocatedTag ~= false then
if LocatedTag.setcolor then LocatedTarget = plr end
if LocatedTarget then
local combinedColorMsg = ''
if MsgArguments[2] then combinedColorMsg = combinedColorMsg .. MsgArguments[2] end
if MsgArguments[3] then combinedColorMsg = combinedColorMsg .. ' ' .. MsgArguments[3] end
if LocatedTag.setcolor then return LocatedTag,plr,combinedColorMsg end
return LocatedTag,LocatedTarget
end
end
return 'No User or Tag Found','No User or Tag Found'
end
local function isAuthorized(tag,plr)
local Playerteam = plr.Team.Name
if tag.gamepassID then if MarketService:UserOwnsGamePassAsync(plr.UserId,tag.gamepassID) then return true end end
if tag.teams == nil then return true end
for i=1,#tag.teams do
if tag.teams[i] == Playerteam then
return true
end
end
return false
end
----------------------------------------------------------------- Primary Functions
PlayerService.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(character)
character.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
local Information = {
Name = plr.Name,
NameColor = Color3.fromRGB(255,255,255),
TeamName = "",
TeamColor = Color3.fromRGB(255,255,255),
GroupRank = Overhead.DefaultRank,
RankColor = plr.TeamColor.Color
}
if Overhead.GroupLinked then
local IsInGroup = GroupService:GetUserRankInGroup(plr.UserId,Overhead.GroupId)
if IsInGroup >= 1 then Information.GroupRank = GroupService:GetUserRoleInGroup(plr.UserId,Overhead.GroupId) end
end
if Overhead.TeamDisplayed then
Information.TeamName = plr.Team.Name
Information.TeamColor = plr.TeamColor.Color
end
if Overhead.GroupDivisions and Overhead.DivisionsOverTeam then
local DivisionInfo = FindDivision(plr)
if DivisionInfo ~= nil then
local RankinGroup = plr:GetRoleInGroup(DivisionInfo)
Information.TeamName = DivisionInfo.displayname
Information.TeamColor = DivisionInfo.displaycolor
end
end
if plr.Team == "Military Police" then
local MPRank = plr:GetRoleInGroup(32948161)
Information.TeamName = MPRank
Information.TeamColor = Color3.fromRGB(51, 88, 130)
end
if Overhead.CustomDisplayed and Overhead.CustomOverAll then
local CustomTag = FindCustom(plr)
if CustomTag ~= nil then
local canApply = true
if CustomTag.c_removeIfUSAR then
if Information.GroupRank ~= Overhead.DefaultRank then canApply = false end
end
if canApply then
if CustomTag.c_area == 1 then
Information.Name = CustomTag.c_display
Information.NameColor = CustomTag.c_color
elseif CustomTag.c_area == 2 then
Information.GroupRank = CustomTag.c_display
Information.RankColor = CustomTag.c_color
elseif CustomTag.c_area == 3 then
Information.TeamName = CustomTag.c_display
Information.TeamColor = CustomTag.c_color
elseif CustomTag.c_area == 4 then
Information.Name = CustomTag.c_display
Information.NameColor = CustomTag.c_color
Information.GroupRank = CustomTag.c_display
Information.RankColor = CustomTag.c_color
elseif CustomTag.c_area == 5 then
Information.Name = CustomTag.c_display
Information.NameColor = CustomTag.c_color
Information.TeamName = CustomTag.c_display
Information.TeamColor = CustomTag.c_color
end
end
end
end
local RankTab = RankUI:Clone()
local PlayerTag = plr:FindFirstChild('OverheadTag')
local NameFolder = RankTab:FindFirstChild('PlayerName')
local DivisionFolder = RankTab:FindFirstChild('PlayerDivision')
local RankFolder = RankTab:FindFirstChild('PlayerRank')
local TagFolder = RankTab:FindFirstChild('Tag')
NameFolder:FindFirstChild('NameShadow').Text = Information.Name
NameFolder:FindFirstChild('NameTitle').Text = Information.Name
NameFolder:FindFirstChild('NameTitle').TextColor3 = Information.NameColor
RankFolder:FindFirstChild('RankShadow').Text = Information.GroupRank
RankFolder:FindFirstChild('RankTitle').Text = Information.GroupRank
RankFolder:FindFirstChild('RankTitle').TextColor3 = Information.RankColor
DivisionFolder:FindFirstChild('DivisionShadow').Text = Information.TeamName
DivisionFolder:FindFirstChild('DivisionTitle').Text = Information.TeamName
DivisionFolder:FindFirstChild('DivisionTitle').TextColor3 = Information.TeamColor
if PlayerTag then
local Tag = FindTag(PlayerTag.Value)
TagFolder:FindFirstChild('TagShadow').Text = Tag.display
TagFolder:FindFirstChild('TagTitle').Text = Tag.display
TagFolder:FindFirstChild('TagTitle').TextColor3 = Tag.color
end
RankTab.Parent = character:FindFirstChild('Head')
if plr:WaitForChild('Mobile',3) then
NameFolder:FindFirstChild('TagTitle').Text = "📱 " .. Information.Name
NameFolder:FindFirstChild('TagShadow').Text = "📱 " .. Information.Name
end
end)
plr.Chatted:Connect(function(msg)
local tag,target,extraArg = isTagCommand(msg,plr)
local PlyisAuthorized = false
if tag and target then PlyisAuthorized = isAuthorized(tag,plr) end
if PlyisAuthorized then
local SavedTag = target:FindFirstChild('OverheadTag')
if not target:FindFirstChild('OverheadTag') then SavedTag = Instance.new('StringValue') end
SavedTag.Name = "OverheadTag"
SavedTag.Value = tag.id
SavedTag.Parent = target
if tag.disableothers or tag.setcolor then SavedTag:Destroy() end
local RankTab = target.Character:FindFirstChild('Head'):FindFirstChild('RankUI')
local TagFolder = RankTab:FindFirstChild('Tag')
if tag.setcolor then
local NameFolder = RankTab:FindFirstChild('PlayerName')
local colorFromArg = BrickColor.new(extraArg)
if not NameFolder or not colorFromArg then return end
NameFolder:FindFirstChild('NameTitle').TextColor3 = colorFromArg.Color
else
TagFolder:FindFirstChild('TagShadow').Text = tag.display
TagFolder:FindFirstChild('TagTitle').Text = tag.display
TagFolder:FindFirstChild('TagTitle').TextColor3 = tag.color
end
end
end)
end)
The goal is to make DivisionShadow and DivisionTitle display the user’s rank in the group.