What's new
Heapleak - Scripthub

Get the most out of HeapLeak by creating a free account! Once signed in, you’ll gain full access to restricted content, be able to share your own scripts, and participate in our member-only discussions.

simple esp Blox strike

Version / Update: v1.0.0
Download / Script Link
--[[
WARNING: Heads up! This script has not been verified by ScriptBlox. Use at your own risk!
]]
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local RunService = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer

local CT_COLOR = Color3.fromRGB(100, 150, 255)
local T_COLOR = Color3.fromRGB(255, 80, 80)
local LOW_HP = Color3.fromRGB(255, 64, 64)
local HIGH_HP = Color3.fromRGB(64, 255, 64)

local function NormalizeTeam(raw)
local s = string.lower(tostring(raw or "")):gsub("[%s_]+", "")
if s == "counter-terrorists" or s == "counterterrorists" or s == "ct" then return "CT" end
if s == "terrorists" or s == "terrorist" or s == "t" then return "T" end
return nil
end

local function GetTeam(plr)
if not plr then return nil end
local fromAttr = NormalizeTeam(plr:GetAttribute("Team"))
if fromAttr then return fromAttr end
local teamObj = plr.Team
if typeof(teamObj) == "Instance" then return NormalizeTeam(teamObj.Name) end
return NormalizeTeam(teamObj)
end

local function IsPlaying(team)
return team == "CT" or team == "T"
end

local function GetChar(plr)
if not plr then return nil end
local c = plr.Character
if c and c:FindFirstChildOfClass("Humanoid") then return c end
local chars = Workspace:FindFirstChild("Characters")
if chars then
local named = chars:FindFirstChild(plr.Name)
if named and named:IsA("Model") and named:FindFirstChildOfClass("Humanoid") then return named end
end
return c
end

local function GetRoot(char)
if not char then return nil end
return char:FindFirstChild("HumanoidRootPart")
or char:FindFirstChild("UpperTorso")
or char:FindFirstChild("Torso")
end

local function MakeSquare(color, thickness, filled)
local s = Drawing.new("Square")
s.Color = color or Color3.new(1,1,1)
s.Thickness = thickness or 1
s.Filled = filled or false
s.Visible = false
return s
end

local Cache = {}

local function GetCache(plr)
if Cache[plr] then return Cache[plr] end
local c = {}
c.BoxOutline = MakeSquare(Color3.new(0,0,0), 3, false)
c.Box = MakeSquare(Color3.new(1,1,1), 1.5, false)
c.HpBG = MakeSquare(Color3.new(0,0,0), 1, true)
c.HpBar = MakeSquare(HIGH_HP, 1, true)
c.All = { c.BoxOutline, c.Box, c.HpBG, c.HpBar }
Cache[plr] = c
return c
end

local function HideAll(c)
for _, d in ipairs(c.All) do d.Visible = false end
end

local function DestroyCache(plr)
local c = Cache[plr]
if not c then return end
for _, d in ipairs(c.All) do pcall(d.Remove, d) end
Cache[plr] = nil
end

local function GetBounds(char)
local root = GetRoot(char)
if not root then return nil end
local head = char:FindFirstChild("Head")
local rootPos = root.Position

local topY
if head then
topY = math.max(head.Position.Y + head.Size.Y * 0.5, rootPos.Y + 3)
else
topY = rootPos.Y + 3
end

local lFoot = char:FindFirstChild("LeftFoot") or char:FindFirstChild("LeftLowerLeg") or char:FindFirstChild("Left Leg")
local botY = lFoot and (lFoot.Position.Y - lFoot.Size.Y * 0.5) or (rootPos.Y - 3)

local height = math.max(topY - botY, 1)
local centerY = (topY + botY) * 0.5
local cf = CFrame.new(rootPos.X, centerY, rootPos.Z)
return cf, Vector3.new(4, height, 4)
end

local function ProjectBox(camera, cf, size)
local hx, hy, hz = size.X*0.5, size.Y*0.5, size.Z*0.5
local corners = {
cf*Vector3.new(-hx, hy,-hz), cf*Vector3.new( hx, hy,-hz),
cf*Vector3.new( hx, hy, hz), cf*Vector3.new(-hx, hy, hz),
cf*Vector3.new(-hx,-hy,-hz), cf*Vector3.new( hx,-hy,-hz),
cf*Vector3.new( hx,-hy, hz), cf*Vector3.new(-hx,-hy, hz),
}
local minX, minY = math.huge, math.huge
local maxX, maxY = -math.huge, -math.huge
local vp = camera.ViewportSize
local visible = 0
for _, corner in ipairs(corners) do
local p, on = camera:WorldToViewportPoint(corner)
if p.Z > 0 then
visible = visible + 1
local cx = math.clamp(p.X, 0, vp.X)
local cy = math.clamp(p.Y, 0, vp.Y)
if cx < minX then minX = cx end
if cy < minY then minY = cy end
if cx > maxX then maxX = cx end
if cy > maxY then maxY = cy end
end
end
if visible == 0 then return nil end
return minX, minY, maxX, maxY
end

local MAX_DIST = 2500

local conn
conn = RunService.RenderStepped:Connect(function()
local camera = Workspace.CurrentCamera
if not camera then return end
local camPos = camera.CFrame.Position
local myTeam = GetTeam(LocalPlayer)

for _, plr in ipairs(Players:GetPlayers()) do
if plr == LocalPlayer then continue end

local c = GetCache(plr)
local team = GetTeam(plr)
if not IsPlaying(team) then HideAll(c); continue end

-- team check: не рисовать союзников
if IsPlaying(myTeam) and myTeam == team then HideAll(c); continue end

local char = GetChar(plr)
if not char then HideAll(c); continue end
local hum = char:FindFirstChildOfClass("Humanoid")
if not hum or hum.Health <= 0 then HideAll(c); continue end
if char:GetAttribute("Dead") == true then HideAll(c); continue end

local root = GetRoot(char)
if not root then HideAll(c); continue end
if (camPos - root.Position).Magnitude > MAX_DIST then HideAll(c); continue end

local cf, sz = GetBounds(char)
if not cf then HideAll(c); continue end

local minX, minY, maxX, maxY = ProjectBox(camera, cf, sz)
if not minX then HideAll(c); continue end

local w = maxX - minX
local h = maxY - minY
if w < 1 or h < 1 then HideAll(c); continue end

local color = (team == "CT") and CT_COLOR or T_COLOR

-- Box
c.BoxOutline.Position = Vector2.new(minX - 1, minY - 1)
c.BoxOutline.Size = Vector2.new(w + 2, h + 2)
c.BoxOutline.Visible = true

c.Box.Color = color
c.Box.Position = Vector2.new(minX, minY)
c.Box.Size = Vector2.new(w, h)
c.Box.Visible = true

-- Health bar
local maxHP = math.max(hum.MaxHealth, 1)
local pct = math.clamp(hum.Health / maxHP, 0, 1)
local barH = math.max(1, h)
local filled = barH * pct
local barX = minX - 6

c.HpBG.Position = Vector2.new(barX - 1, minY - 1)
c.HpBG.Size = Vector2.new(4, barH + 2)
c.HpBG.Visible = true

c.HpBar.Position = Vector2.new(barX, maxY - filled)
c.HpBar.Size = Vector2.new(2, filled)
c.HpBar.Color = LOW_HP:Lerp(HIGH_HP, pct)
c.HpBar.Visible = true
end
end)

Players.PlayerRemoving:Connect(DestroyCache)
[ View More ]
6688c949-15db-487b-8de2-5485b289c8e6.webp


team check box and health Run the script and have fun!
 
Back
Top