
Key Required
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer
local COLORS = {
FRIENDLY = Color3.fromRGB(0, 255, 0),
HOSTILE = Color3.fromRGB(255, 0, 0),
NEUTRAL = Color3.fromRGB(255, 255, 255)
}
local function getTeamStatusColor(targetPlayer)
local myTeam = LocalPlayer.Team and LocalPlayer.Team.Name or ""
local targetTeam = targetPlayer.Team and targetPlayer.Team.Name or ""
if targetTeam == "Guards" then
if myTeam == "Guards" then
return COLORS.FRIENDLY
else
return COLORS.HOSTILE
end
end
if targetTeam == "Criminals" or targetTeam == "Inmates" then
if myTeam == "Guards" then
return COLORS.HOSTILE
else
return COLORS.FRIENDLY
end
end
return COLORS.NEUTRAL
end
local function createESP(player)
if player == LocalPlayer then return end
local function onCharacterAdded(character)
local humanoid = character:WaitForChild("Humanoid", 10)
local head = character:WaitForChild("Head", 10)
local root = character:WaitForChild("HumanoidRootPart", 10)
if not humanoid or not head or not root then return end
local highlight = character:FindFirstChild("ESPHighlight") or Instance.new("Highlight")
highlight.Name = "ESPHighlight"
highlight.Parent = character
highlight.FillTransparency = 0.5
highlight.OutlineTransparency = 0
highlight.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
local billboard = head:FindFirstChild("ESPBillboard") or Instance.new("BillboardGui")
billboard.Name = "ESPBillboard"
billboard.Size = UDim2.new(0, 200, 0, 50)
billboard.StudsOffset = Vector3.new(0, 3, 0)
billboard.AlwaysOnTop = true
billboard.Parent = head
local label = billboard:FindFirstChild("TextLabel") or Instance.new("TextLabel")
label.Size = UDim2.new(1, 0, 1, 0)
label.BackgroundTransparency = 1
label.TextStrokeTransparency = 0
label.TextSize = 16
label.Font = Enum.Font.SourceSansBold
label.Parent = billboard
local connection
connection = RunService.RenderStepped:Connect(function()
if not character or not character.Parent or not humanoid or humanoid.Health <= 0 then
connection:Disconnect()
billboard:Destroy()
highlight:Destroy()
return
end
local dynamicColor = getTeamStatusColor(player)
highlight.FillColor = dynamicColor
highlight.OutlineColor = dynamicColor
label.TextColor3 = dynamicColor
local hp = math.floor(humanoid.Health)
local cam = workspace.CurrentCamera
local distance = math.floor((root.Position - cam.CFrame.Position).Magnitude)
label.Text = string.format("%s\nHP: %d | %d Studs", player.Name, hp, distance)
end)
end
player.CharacterAdded:Connect(onCharacterAdded)
if player.Character then
onCharacterAdded(player.Character)
end
end
for _, player in ipairs(Players:GetPlayers()) do
createESP(player)
end
Players.PlayerAdded:Connect(createESP)
Now you canot die!
L