0% found this document useful (0 votes)
19 views

Message

This document contains code to add an ESP (wallhack) feature to a game. It loads player characters and displays boxes and nametags above their heads through the use of adornments. It handles loading and updating player data and removing it when players leave.

Uploaded by

ahmetcanalpalt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Message

This document contains code to add an ESP (wallhack) feature to a game. It loads player characters and displays boxes and nametags above their heads through the use of adornments. It handles loading and updating player data and removing it when players leave.

Uploaded by

ahmetcanalpalt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Tab2:AddButton({

Name = "ESP (ON)",


Callback = function()
local Holder = Instance.new("Folder", game.CoreGui)
Holder.Name = "ESP"

local Box = Instance.new("BoxHandleAdornment")


Box.Name = "nilBox"
Box.Size = Vector3.new(4, 7, 4)
Box.Color3 = Color3.new(100 / 255, 100 / 255, 100 / 255)
Box.Transparency = 0.7
Box.ZIndex = 0
Box.AlwaysOnTop = true
Box.Visible = true

local NameTag = Instance.new("BillboardGui")


NameTag.Name = "nilNameTag"
NameTag.Enabled = false
NameTag.Size = UDim2.new(0, 200, 0, 50)
NameTag.AlwaysOnTop = true
NameTag.StudsOffset = Vector3.new(0, 1.8, 0)
local Tag = Instance.new("TextLabel", NameTag)
Tag.Name = "Tag"
Tag.BackgroundTransparency = 1
Tag.Position = UDim2.new(0, -50, 0, 0)
Tag.Size = UDim2.new(0, 300, 0, 20)
Tag.TextSize = 0
Tag.TextColor3 = Color3.new(100 / 255, 100 / 255, 100 / 255)
Tag.TextStrokeColor3 = Color3.new(0 / 255, 0 / 255, 0 / 255)
Tag.TextStrokeTransparency = 1
Tag.Text = "nil"
Tag.Font = Enum.Font.SourceSansBold
Tag.TextScaled = false

local LoadCharacter = function(v)


repeat wait() until v.Character ~= nil
v.Character:WaitForChild("Humanoid")
local vHolder = Holder:FindFirstChild(v.Name)
vHolder:ClearAllChildren()
local b = Box:Clone()
b.Name = v.Name .. "Box"
b.Adornee = v.Character
b.Parent = vHolder
local t = NameTag:Clone()
t.Name = v.Name .. "NameTag"
t.Enabled = true
t.Parent = vHolder
t.Adornee = v.Character:WaitForChild("Head", 5)
if not t.Adornee then
return UnloadCharacter(v)
end
t.Tag.Text = v.Name
b.Color3 = Color3.new(v.TeamColor.r, v.TeamColor.g, v.TeamColor.b)
t.Tag.TextColor3 = Color3.new(v.TeamColor.r, v.TeamColor.g,
v.TeamColor.b)
local Update
local UpdateNameTag = function()
if not pcall(function()
v.Character.Humanoid.DisplayDistanceType =
Enum.HumanoidDisplayDistanceType.None
local maxh = math.floor(v.Character.Humanoid.MaxHealth)
local h = math.floor(v.Character.Humanoid.Health)
t.Tag.Text = v.Name .. "\n" .. ((maxh ~= 0 and
tostring(math.floor((h / maxh) * 100))) or "0") .. "% " .. tostring(h) .. "/" ..
tostring(maxh)
end) then
Update:Disconnect()
end
end
UpdateNameTag()
Update = v.Character.Humanoid.Changed:Connect(UpdateNameTag)
end

local UnloadCharacter = function(v)


local vHolder = Holder:FindFirstChild(v.Name)
if vHolder and (vHolder:FindFirstChild(v.Name .. "Box") ~= nil or
vHolder:FindFirstChild(v.Name .. "NameTag") ~= nil) then
vHolder:ClearAllChildren()
end
end

local LoadPlayer = function(v)


local vHolder = Instance.new("Folder", Holder)
vHolder.Name = v.Name
v.CharacterAdded:Connect(function()
pcall(LoadCharacter, v)
end)
v.CharacterRemoving:Connect(function()
pcall(UnloadCharacter, v)
end)
v.Changed:Connect(function(prop)
if prop == "TeamColor" then
UnloadCharacter(v)
wait()
LoadCharacter(v)
end
end)
LoadCharacter(v)
end

local UnloadPlayer = function(v)


UnloadCharacter(v)
local vHolder = Holder:FindFirstChild(v.Name)
if vHolder then
vHolder:Destroy()
end
end

for i,v in pairs(game:GetService("Players"):GetPlayers()) do


spawn(function() pcall(LoadPlayer, v) end)
end

game:GetService("Players").PlayerAdded:Connect(function(v)
pcall(LoadPlayer, v)
end)

game:GetService("Players").PlayerRemoving:Connect(function(v)
pcall(UnloadPlayer, v)
end)

for _,v in pairs(game:GetService("Players"):GetPlayers()) do


v.Changed:Connect(function(prop)
if prop == "TeamColor" then
UnloadCharacter(v)
wait()
LoadCharacter(v)
end
end)
end
end
})

Tab2:AddButton({
Name = "ESP (OFF)",
Callback = function()
game:GetService("CoreGui").ESP:Destroy()
end
})

You might also like