Get rid of a few letters in an overhead rank display

Hey! I’ve got a pretty basic script right now, it just simply shows a players name, and rank. However, I’m trying to edit something a little bit.

Essentially what I want is this;

Let’s say a players rank was ‘[DEV] Developer’
Instead of showing ‘[DEV] Developer’ as their rank;

I’d like it to remove the first 6 letters of every rank, showing the rank as ‘Developer’ instead.

Is there anyway to do this besides just checking for the rankname and changing it manually for each rank?

This is what I have so far:

local overhead = script.BillboardGui
local teams = game:GetService(“Teams”):GetChildren()

game.Players.PlayerAdded:Connect(function(player)

player.CharacterAdded:Connect(function(char)
local newovh = overhead:Clone()

  local nametag = newovh:WaitForChild('Name')
  local ranktag = newovh:WaitForChild('Rank')

  nametag.Text = player.Name
  ranktag.Text = player:GetRoleInGroup({groupid})
  
  char.Humanoid.DisplayDistanceType = 'None'
  
  newovh.Parent = char:WaitForChild('HumanoidRootPart')

end)
end)

2 Likes

Do you just want to remove the first 6 letters for every rank?

1 Like

You can use string.sub()

-- from your code
local role = player:GetRoleInGroup({groupid})
-- you wanted to skip the first 6 letters, so 7 allows it to start at the 7th character, and #role gets the remaining characters in the string.
ranktag.Text = string.sub(role, 7, #role)

-- example test
local str = "[Dev] Developer" print(string.sub(str, 7, #str))
--this would print Developer
1 Like

Yeah, just the first few letters of ever single rank.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.