I want to display the names and health of my team-mates by using the default name/health system. I have tried some code and it does not work, the player’s names and health do not show from very far away, it uses the default display distance and type. Any help would be appreciated.
--// SERVICES
local playersService = game:GetService('Players')
local localPlayer = playersService.LocalPlayer
for playerNum,indivPlayer in pairs(game.Players:GetChildren()) do
local indivCharacter = indivPlayer.Character
local indivHumanoid = indivCharacter:FindFirstChild("Humanoid")
if localPlayer.TeamColor == BrickColor.new('Bright red') or localPlayer.TeamColor == BrickColor.new('Medium stone grey') then
if (indivPlayer.TeamColor == BrickColor.new('Bright red') or indivPlayer.TeamColor == BrickColor.new('Medium stone grey')) then
indivHumanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.Viewer
indivHumanoid.HealthDisplayDistance = math.huge
indivHumanoid.NameDisplayDistance = math.huge
indivHumanoid.NameOcclusion = Enum.NameOcclusion.EnemyOcclusion
print ('Show me names and health of anyone on EITHER of these teams')
end
elseif localPlayer.TeamColor == BrickColor.new('Brown') then
if indivPlayer.TeamColor == BrickColor.new('Brown') then
indivHumanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.Viewer
indivHumanoid.HealthDisplayDistance = math.huge
indivHumanoid.NameDisplayDistance = math.huge
indivHumanoid.NameOcclusion = Enum.NameOcclusion.EnemyOcclusion
print ('Show me names and health of anyone on this team')
end
elseif localPlayer.TeamColor == BrickColor.new('Really black') then
if indivPlayer.TeamColor == BrickColor.new('Really black') then
indivHumanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.Viewer
indivHumanoid.HealthDisplayDistance = math.huge
indivHumanoid.NameDisplayDistance = math.huge
indivHumanoid.NameOcclusion = Enum.NameOcclusion.EnemyOcclusion
print ('Show me names and health of anyone on this team')
end
end
end