Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Nametag script not working for specific teams. Why won't it appear for these last two teams?

local BBGUI = game.ServerStorage.BillboardGui
local DEVGUI = game.ServerStorage.DevNameTag

local SouthsideID = 6209170
local SpecialForcesID = 6623543
local MilitaryPoliceID = 6655185
local FacilitySecurityID = 6623539
local EngineeringAndTechnicalID = 7677830
local DevelopmentTeamID = 7210311
local ModerationTeamID = 6623548
local HostileForcesID = 5767367
local PrisonIntelligenceID = 6623533

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		if player.TeamColor.Name == "Sunrise" then
			local CGUI = BBGUI:Clone()
			CGUI.TextLabel.TextColor3 = Color3.fromRGB(212, 144, 189)
			CGUI.TextLabel.Text = player.Name.."\n"..player:GetRoleInGroup(ModerationTeamID)
			CGUI.Parent = game.Workspace:WaitForChild(player.Name).Head
		elseif player.TeamColor.Name == "Persimmon" then
			local CGUI = BBGUI:Clone()
			CGUI.TextLabel.TextColor3 = Color3.fromRGB(255, 89, 89)
			CGUI.TextLabel.Text = "[EXPUNGED]".."\n"..player:GetRoleInGroup(PrisonIntelligenceID)
			CGUI.Parent = game.Workspace:WaitForChild(player.Name).Head
		elseif player.TeamColor.Name == "Dusty Rose" then
			local CGUI = BBGUI:Clone()
			CGUI.TextLabel.TextColor3 = Color3.fromRGB(255,0,0)
			if player:GetRankInGroup(HostileForcesID) > 0 then
				CGUI.TextLabel.Text = player.Name.."\n"..player:GetRoleInGroup(HostileForcesID)
			else
				CGUI.TextLabel.Text = player.Name.."\n".."Hostile Raider"
			end
			CGUI.Parent = game.Workspace:WaitForChild(player.Name).Head
		elseif player.TeamColor.Name == "Neon orange" then
			local CGUI = BBGUI:Clone()
			CGUI.TextLabel.TextColor3 = Color3.fromRGB(213, 115, 61)
			CGUI.TextLabel.Text = player.Name.."\n".."Inmate"
			CGUI.Parent = game.Workspace:WaitForChild(player.Name).Head
		elseif player.TeamColor.Name == "Cocoa" then
			local CGUI = BBGUI:Clone()
			CGUI.TextLabel.TextColor3 = Color3.fromRGB(86, 36, 36)
			CGUI.TextLabel.Text = player.Name.."\n".."Emergency Response Team"
			CGUI.Parent = game.Workspace:WaitForChild(player.Name).Head
		elseif player.TeamColor.Name == "Tawny" then
			local CGUI = BBGUI:Clone()
			CGUI.TextLabel.TextColor3 = Color3.fromRGB(150, 85, 85)
			CGUI.TextLabel.Text = player.Name.."\n"..player:GetRoleInGroup(SouthsideID)
			CGUI.Parent = game.Workspace:WaitForChild(player.Name).Head
		elseif player.Team.Name == "Terra Cotta" then
			local CGUI = BBGUI:Clone()
			CGUI.TextLabel.TextColor3 = Color3.fromRGB(190, 104, 98)
			CGUI.TextLabel.Text = "[REDACTED]".."\n"..player:GetRoleInGroup(SpecialForcesID)
			CGUI.Parent = game.Workspace:WaitForChild(player.Name).Head
		elseif player.Team.Name == "Forest green" then
			local CGUI = BBGUI:Clone()
			CGUI.TextLabel.TextColor3 = Color3.fromRGB(31, 128, 29)
			CGUI.TextLabel.Text = player.Name.."\n"..player:GetRoleInGroup(MilitaryPoliceID)
			CGUI.Parent = game.Workspace:WaitForChild(player.Name).Head
		end
	end)
end)

The last 2 elseif statements don't work. The teams Terra Cotta and Forest green.

1 answer

Solved. I just realized that I wrote player.Team.Name instead of player.TeamColor.Name

This discussion is preserved as it was. New answers, comments, and votes are closed.