Help on Nametag Script

Im searching for a nametag script that will change the nametag rank to the player’s current rank in a group and when you bought a gamepass, the rank will also have different colors for each group rank. I’ve been searching through toolbox, devforums, google and youtube but haven’t found one that i want.

1 Like

There are many nametag videos on YouTube, I’m sure you can add your own twist to the script to make it work the way you want.

If you want a gamepass then looking marketplace service and you basically check whether they have the gamepass if they do then add there nametag if not prompt the user.

2 Likes

Do something like:

local playerRank = script.Parent
playerRank.Text = plr:GetRoleInGroup(groupID)
if playerRank.Text == "Owner" then
-- Colors here
elseif playerRank.Text == "Admin" then
-- Colors here
else
-- Colors h
3 Likes

Here is a code I made myself in 2020 when I was not a part of the DevForum (kinda a re-make of @THECOOLGENERATOR code):

local rank = script.Parent or workspace.NametagPart.Nametag.Rank
local groupID = 0 -- Your group Id

rank.Text == plr:GetRoleInGroup(groupId) or "Not in the group"

game.Players.PlayerAdded:Connect(function(plr)
if rank.Text == "Owner" then -- Replace Owner by the group creator rank name
rank.BackgroundColor3 = false -- Replace false with the code for the color
elseif rank.Text == "Admin" then -- Replace Admin by the group admin rank name
rank.BackgroundColor3 = false -- Replace false with the code for the color
elseif plr:GetRoleInGroup(groupId) == "Guest" then
rank.BackgroundColor3 = false -- Replace false with the code for the color
     end
  end)
end

Also. You do this but when would you change the color? When the player is added or never?

I don’t think it really matters. By the way,

rank.Text == plr:GetRoleInGroup(groupId) or “Not in the group”

The rank would never be “Not in the group”. This is because roblox’s API automatically sets the role to “Guest”, not nil. I was surprised too when I made my first nametag lol

Here’s a reference you can use :wink: