Hi I’m working on a modular overhead rank system with tags.
Tag Screenshot:
Tag Defaults:
By tags I mean rectangles above your head with text, for example Premium, Staff, Developer.
If they own a gamepass, they get the tag for it.
I’ve worked out a way to do it but I’m having trouble making it work math-wise.
The tags are going to be dynamic, depending on the textbounds the tag will resize itself accordingly before being inserted to the player’s overhead.
I’m trying to work out a way I can do this mathmatically as I’m not the best at math lol.
I need the tags to have padding of 0.02 and for all the tags together to be centered.
My tags are currently anchorpointed??? at 0.5,0.5.
My current script snippet is here:
local Ranks = {
Premium = {
-- Config
OverheadText = "Premium",
OverheadFont = "GothamBold",
OverheadColor = Color3.fromRGB(0, 85, 127),
-- Permissions (who will have it)
UserIds = {000},
BadgeIds = {000},
GroupRanks = {000},
Gamepasses = {14751366},
},
Premium2 = {
-- Config
OverheadText = "Premium222",
OverheadFont = "GothamBold",
OverheadColor = Color3.fromRGB(170, 0, 255),
-- Permissions (who will have it)
UserIds = {304343782},
BadgeIds = {000},
GroupRanks = {000},
Gamepasses = {2},
},
}
function Boot(Player)
Player.Character.Head.Rank.Template.Visible = false
for _, Tab in pairs(Ranks) do
for _, UserId in pairs(Tab.UserIds) do
if UserId == Player.UserId then
AddTabToPlayer(Player,Tab)
end
end
for _, BadgeId in pairs(Tab.BadgeIds) do
if BadgeId > 1000 then
if game:GetService("BadgeService"):UserHasBadgeAsync(Player.UserId,BadgeId) then
AddTabToPlayer(Player,Tab)
end
end
end
for _, Rank in pairs(Tab.GroupRanks) do
if Player:GetRankInGroup(GroupId) > Rank then
AddTabToPlayer(Player,Tab)
end
end
for _, Gamepass in pairs(Tab.Gamepasses) do
if Gamepass > 1000 then
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId,Gamepass) == true then
AddTabToPlayer(Player,Tab)
end
end
end
end
end
function AddTabToPlayer(Player,Tab)
if Player.MocaexValues:FindFirstChild("TabsEnabled") and not Player.Character.Head.Rank:FindFirstChild(Tab.OverheadText) then
local TabsEnabled = Player.MocaexValues.TabsEnabled.Value
TabsEnabled = TabsEnabled + 1
local NewTab = Player.Character.Head.Rank.Template:Clone()
NewTab.Parent = Player.Character.Head.Rank
NewTab.Visible = true
NewTab.Name = Tab.OverheadText
NewTab.Text.Text = Tab.OverheadText
NewTab.Text.Font = Tab.OverheadFont
NewTab.ImageColor3 = Tab.OverheadColor
local fullsize = 0
for _, Tab in ipairs(Player.Character.Head.Rank:GetChildren()) do
if Tab.Name ~= "Template" and Tab.ClassName == "ImageLabel" then
fullsize = fullsize + Tab.Size.X.Scale
end
end
local PositionToMinus = fullsize / TabsEnabled
for _, Tab in ipairs(Player.Character.Head.Rank:GetChildren()) do
if Tab.Name ~= "Template" and Tab.ClassName == "ImageLabel" then
print(Tab.Name)
Tab.Position = UDim2.new(Tab.Position.X.Scale - PositionToMinus,Tab.Position.X.Offset,Tab.Position.Y.Scale,Tab.Position.Y.Offset)
end
end
end
end