Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to stop the names above players' heads from switching colors when they change teams?

Asked by 3 years ago

Anytime I try to Google it, I only get results about the names in the chat window. I'm talking about the one above characters/Humanoids that only other players can see.

https://i.imgur.com/2hICyw5.gif

1 answer

Log in to vote
3
Answered by 3 years ago

You have to do this by using some BillboardGui's and Hiding the players display name.

Server script ( put this in ServerScriptService ):

local Players = game:GetService("Players")

local fonts = {
    Fredoka = Enum.Font.FredokaOne,
    Bangers = Enum.Font.Bangers,
    Creepster = Enum.Font.Creepster,
    Arcade = Enum.Font.Arcade,
    Classic = Enum.Font.Code
}

local function Tag(Character, Text, Color, Font)

  local R = Color[1]
  local G = Color[2]
  local B = Color[3]

  if Font ~= nil then
     ChosenFont = Font
  end

  if Font == nil then
    ChosenFont = fonts.Classic
  end

  local BBGUI = Instance.new("BillboardGui")
  local BBGUI_Text = Instance.new("TextLabel")

  BBGUI.Parent = Character:FindFirstChild"Head"
  BBGUI.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  BBGUI.Active = true
  BBGUI.AlwaysOnTop = true
  BBGUI.LightInfluence = 1.000
  BBGUI.Size = UDim2.new(0, 200, 0, 50)
  BBGUI.StudsOffset = Vector3.new(0, 2, 0)

  BBGUI_Text.Parent = BBGUI
  BBGUI_Text.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  BBGUI_Text.BackgroundTransparency = 1.000
  BBGUI_Text.Size = UDim2.new(0, 200, 0, 50)
  BBGUI_Text.Font = ChosenFont
  BBGUI_Text.Text = Text
  BBGUI_Text.TextColor3 = Color3.fromRGB(R, G, B)
  BBGUI_Text.TextScaled = true
  BBGUI_Text.TextSize = 14.00
  BBGUI_Text.TextWrapped = false

end

local function CharacterAdded(Character)
      Tag(Character, Character.Name, {255,255,255}, fonts.Classic)
end

local function Hide(Player)
    Player.HealthDisplayDistance = 0
    Player.NameDisplayDistance = 0

    Player.CharacterAdded:Connect(CharacterAdde)
end

Players.PlayerAdded:Connect(Hide)
Ad

Answer this question