Advertisement
Lucasluz

ESP

Sep 28th, 2024
6,199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.39 KB | None | 0 0
  1. -- Script de ESP
  2.  
  3. local player = game.Players.LocalPlayer
  4. local ESPs = {}
  5.  
  6. -- Função para criar o ESP
  7. local function createESP(targetPlayer)
  8.     if targetPlayer.Character and targetPlayer.Character:FindFirstChild("Head") then
  9.         local BillboardGui = Instance.new("BillboardGui")
  10.         BillboardGui.Name = "ESP"
  11.         BillboardGui.Parent = targetPlayer.Character.Head
  12.         BillboardGui.AlwaysOnTop = true
  13.         BillboardGui.Size = UDim2.new(0, 100, 0, 40)
  14.         BillboardGui.StudsOffset = Vector3.new(0, 2, 0)
  15.  
  16.         local NameTag = Instance.new("TextLabel")
  17.         NameTag.Parent = BillboardGui
  18.         NameTag.BackgroundTransparency = 1
  19.         NameTag.Size = UDim2.new(1, 0, 0.5, 0)
  20.         NameTag.Text = targetPlayer.Name
  21.         NameTag.TextColor3 = Color3.fromRGB(255, 255, 255)
  22.         NameTag.TextStrokeTransparency = 0.5
  23.         NameTag.TextScaled = true
  24.  
  25.         local HealthTag = Instance.new("TextLabel")
  26.         HealthTag.Parent = BillboardGui
  27.         HealthTag.BackgroundTransparency = 1
  28.         HealthTag.Position = UDim2.new(0, 0, 0.5, 0)
  29.         HealthTag.Size = UDim2.new(1, 0, 0.5, 0)
  30.         HealthTag.TextColor3 = Color3.fromRGB(255, 0, 0)
  31.         HealthTag.TextStrokeTransparency = 0.5
  32.         HealthTag.TextScaled = true
  33.  
  34.         game:GetService("RunService").RenderStepped:Connect(function()
  35.             if targetPlayer.Character and targetPlayer.Character:FindFirstChild("Humanoid") then
  36.                 HealthTag.Text = "HP: " .. math.floor(targetPlayer.Character.Humanoid.Health)
  37.                 local distance = (player.Character.HumanoidRootPart.Position - targetPlayer.Character.HumanoidRootPart.Position).magnitude
  38.                 NameTag.Text = targetPlayer.Name .. " (" .. math.floor(distance) .. "m)"
  39.             end
  40.         end)
  41.  
  42.         table.insert(ESPs, BillboardGui)
  43.     end
  44. end
  45.  
  46. -- Aplica ESP a todos os jogadores
  47. for _, targetPlayer in pairs(game.Players:GetPlayers()) do
  48.     if targetPlayer ~= player then
  49.         createESP(targetPlayer)
  50.     end
  51. end
  52.  
  53. game.Players.PlayerAdded:Connect(function(targetPlayer)
  54.     targetPlayer.CharacterAdded:Connect(function()
  55.         wait(1)
  56.         createESP(targetPlayer)
  57.     end)
  58. end)
  59.  
  60. -- Função para desativar ESP
  61. local function disableESP()
  62.     for _, esp in pairs(ESPs) do
  63.         esp:Destroy()
  64.     end
  65.     ESPs = {}
  66. end
  67.  
  68. -- Desative o ESP chamando disableESP() quando necessário
Tags: esp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement