Script
local Players = game:GetService("Players")
local UIS = game:GetService("UserInputService")
local enabled = false
local function highlightPlayer(player)
if player == Players.LocalPlayer then
return
end
local character = player.Character
if not character then return end
-- Highlight
local highlight = character:FindFirstChild("PlayerHighlight")
if enabled and not highlight then
highlight = Instance.new("Highlight")
highlight.Name = "PlayerHighlight"
highlight.Parent = character
elseif not enabled and highlight then
highlight:Destroy()
end
-- Name and team tag
local head = character:FindFirstChild("Head")
if not head then return end
local tag = head:FindFirstChild("PlayerNameTag")
if enabled and not tag then
tag = Instance.new("BillboardGui")
tag.Name = "PlayerNameTag"
tag.Size = UDim2.new(0, 220, 0, 60)
tag.StudsOffset = Vector3.new(0, 3, 0)
tag.AlwaysOnTop = true
tag.Parent = head
local label = Instance.new("TextLabel")
label.Name = "Info"
label.Size = UDim2.fromScale(1, 1)
label.BackgroundTransparency = 1
label.TextColor3 = Color3.new(1, 1, 1)
label.TextStrokeTransparency = 0
label.TextScaled = true
label.Font = Enum.Font.GothamBold
label.Parent = tag
end
if enabled and tag then
local label = tag:FindFirstChild("Info")
if label then
local teamName = player.Team and player.Team.Name or "No Team"
label.Text = player.Name .. "\n[" .. teamName .. "]"
label.TextColor3 = player.Team
and player.Team.TeamColor.Color
or Color3.new(1, 1, 1)
end
elseif not enabled and tag then
tag:Destroy()
end
end
local function updateAllPlayers()
for _, player in Players:GetPlayers() do
highlightPlayer(player)
end
end
UIS.InputBegan:Connect(function(input, processed)
if processed then return end
if input.KeyCode == Enum.KeyCode.P then
enabled = not enabled
updateAllPlayers()
end
end)
local function setupPlayer(player)
player.CharacterAdded:Connect(function()
task.wait(1)
highlightPlayer(player)
end)
player:GetPropertyChangedSignal("Team"):Connect(function()
highlightPlayer(player)
end)
end
for _, player in Players:GetPlayers() do
setupPlayer(player)
end
Players.PlayerAdded:Connect(setupPlayer)
print("Team ESP loaded! Press P to toggle.")Features
- Press P to active, press again to deactivate