Esp with health bar ONLY FOR GAMES WITH TEAMS
Key RequiredUniversal

Esp with health bar ONLY FOR GAMES WITH TEAMS

Universal ScriptJohn_SkibidiJohn_Skibidi 2.4K views 258 executesUpdated Sep 5, 2025
5.0/ 5(1 votes)
10100% Positive
Lua Script•93 lines (2733 chars)
local Players = game:GetService("Players")

-- Function to apply team-colored highlight
local function applyHighlightToCharacter(player, character)
	if not player.Team then return end

	-- Remove existing highlight if any
	local oldHighlight = character:FindFirstChild("TeamHighlight")
	if oldHighlight then
		oldHighlight:Destroy()
	end

	local highlight = Instance.new("Highlight")
	highlight.Name = "TeamHighlight"
	highlight.FillTransparency = 0.5
	highlight.OutlineTransparency = 1
	highlight.FillColor = player.TeamColor.Color
	highlight.Adornee = character
	highlight.Parent = character
end

-- Function to add a health bar BillboardGui
local function addHealthBar(player, character)
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	if not humanoid then return end

	-- Remove old health bar if any
	local oldGui = character:FindFirstChild("HealthBar")
	if oldGui then oldGui:Destroy() end

	local billboard = Instance.new("BillboardGui")
	billboard.Name = "HealthBar"
	billboard.Size = UDim2.new(4, 0, 0.5, 0)
	billboard.StudsOffset = Vector3.new(0, 4, 0)
	billboard.AlwaysOnTop = true
	billboard.Parent = character

	local bg = Instance.new("Frame")
	bg.Size = UDim2.new(1, 0, 1, 0)
	bg.BackgroundColor3 = Color3.new(0.1, 0.1, 0.1)
	bg.BorderSizePixel = 0
	bg.Parent = billboard

	local bar = Instance.new("Frame")
	bar.Name = "Health"
	bar.Size = UDim2.new(1, 0, 1, 0)
	bar.BackgroundColor3 = Color3.new(0, 1, 0)
	bar.BorderSizePixel = 0
	bar.Parent = bg

	-- Update health bar when health changes
	humanoid.HealthChanged:Connect(function(health)
		local percent = math.clamp(health / humanoid.MaxHealth, 0, 1)
		bar.Size = UDim2.new(percent, 0, 1, 0)

		-- Optional: Color changes with health %
		if percent > 0.5 then
			bar.BackgroundColor3 = Color3.new(0, 1, 0) -- green
		elseif percent > 0.25 then
			bar.BackgroundColor3 = Color3.new(1, 1, 0) -- yellow
		else
			bar.BackgroundColor3 = Color3.new(1, 0, 0) -- red
		end
	end)
end

-- Function to handle when a player spawns
local function onPlayerAdded(player)
	-- Update team highlight if team changes
	player:GetPropertyChangedSignal("Team"):Connect(function()
		if player.Character then
			applyHighlightToCharacter(player, player.Character)
		end
	end)

	player.CharacterAdded:Connect(function(character)
		repeat task.wait() until character:FindFirstChild("HumanoidRootPart")
		applyHighlightToCharacter(player, character)
		addHealthBar(player, character)
	end)
end

-- Existing players
for _, player in ipairs(Players:GetPlayers()) do
	onPlayerAdded(player)
	if player.Character then
		applyHighlightToCharacter(player, player.Character)
		addHealthBar(player, player.Character)
	end
end

-- New players
Players.PlayerAdded:Connect(onPlayerAdded)

Features & Information

A ESP made by AI because idk just dont hate me for that
#Ai#Esp#Highlight#Artificial Intelligence

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts