How to make a team nametag?

Hiya! I have this code, but I want the division tag to change based on their team, currently it is what team they join on. I’ve worked to the best of my ability, but I am horrible at scripting, any help is appreciated.

local GUI = script.OverheadUI
        local CloneGUI = GUI:Clone()
        local Username = CloneGUI.Username
        local Rank = CloneGUI.Rank
        local SecondRank = CloneGUI.Division
        local SecondGradient = CloneGUI.Division.Gradient
        local maingroup = 11357231 -- Change it to your main group ID
        Username.Text = Player.Name
        SecondRank.Text = Player.Team.Name
        if Player:IsInGroup(maingroup) then
            Rank.Text = Player:GetRoleInGroup(maingroup)
        CloneGUI.Parent = Char.Head
        SecondGradient.BackgroundColor3 = Player.TeamColor.Color

(Here is an image)

Do you have any error logs?

1 Like

No, it goes to the team the player joins on, but doesn’t change when the player changes teams.

In that script you don’t detect when the player changes team, do you?

1 Like

I don’t think so, but I don’t know how to make that.

If I found how to detect the change, how will I make it update the tag?

Edit/remove the old one.

No worries, you can detect team changes:

local TeamsService = game:GetService("Teams")

for _, team in pairs(TeamsService:GetTeams()) do
        print(player.Name.. " has joined "

Thanks so much! I’ll try that, once I do that, would I just saw to run the script again?

You could use your old script, yes.

Alright, thanks so much!

1 Like

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