Advertisement
zsx5e

ESP

Jun 20th, 2023 (edited)
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.95 KB | None | 0 0
  1. -- ESP --
  2.  
  3.  
  4. ALLYCOLOR = {0,255,255}    
  5. ENEMYCOLOR =  {255,0,0}    
  6. TRANSPARENCY = 0.5          
  7. HEALTHBAR_ACTIVATED = true  
  8.                            
  9. function createFlex()
  10.  
  11. players = game:GetService("Players")
  12. faces = {"Front","Back","Bottom","Left","Right","Top"}
  13. currentPlayer = nil
  14. lplayer = players.LocalPlayer
  15.  
  16. players.PlayerAdded:Connect(function(p)
  17.     currentPlayer = p
  18.         p.CharacterAdded:Connect(function(character)
  19.             createESP(character)            
  20.         end)        
  21. end)
  22.  
  23. function checkPart(obj)  if (obj:IsA("Part") or obj:IsA("MeshPart")) and obj.Name~="HumanoidRootPart" then return true end end -
  24.  
  25. function actualESP(obj)
  26.    
  27.     for i=0,5 do
  28.         surface = Instance.new("SurfaceGui",obj)
  29.         surface.Face = Enum.NormalId[faces[i+1]]
  30.         surface.AlwaysOnTop = true
  31.  
  32.         frame = Instance.new("Frame",surface)  
  33.         frame.Size = UDim2.new(1,0,1,0)
  34.         frame.BorderSizePixel = 0                                              
  35.         frame.BackgroundTransparency = TRANSPARENCY
  36.             if currentPlayer.Team == players.LocalPlayer.Team then
  37.                     frame.BackgroundColor3 = Color3.new(ALLYCOLOR[1],ALLYCOLOR[2],ALLYCOLOR[3])                                        
  38.             else
  39.                 frame.BackgroundColor3 = Color3.new(ENEMYCOLOR[1],ENEMYCOLOR[2],ENEMYCOLOR[3])  
  40.             end
  41.                                                            
  42.     end
  43. end
  44.  
  45. function createHealthbar(hrp)
  46.     board =Instance.new("BillboardGui",hrp)
  47.     board.Name = "total"
  48.     board.Size = UDim2.new(1,0,1,0)
  49.     board.StudsOffset = Vector3.new(3,1,0)
  50.     board.AlwaysOnTop = true
  51.  
  52.     bar = Instance.new("Frame",board)
  53.     bar.BackgroundColor3 = Color3.new(255,0,0)
  54.     bar.BorderSizePixel = 0
  55.     bar.Size = UDim2.new(0.2,0,4,0)
  56.     bar.Name = "total2"
  57.                                                
  58.     health = Instance.new("Frame",bar)
  59.     health.BackgroundColor3 = Color3.new(0,255,0)
  60.     health.BorderSizePixel = 0
  61.     health.Size = UDim2.new(1,0,hrp.Parent.Humanoid.Health/100,0)
  62.         hrp.Parent.Humanoid.Changed:Connect(function(property)
  63.             hrp.total.total2.Frame.Size = UDim2.new(1,0,hrp.Parent.Humanoid.Health/100,0)                              
  64.         end)
  65. end
  66. function createESP(c)
  67.     bugfix = c:WaitForChild("Head")
  68.     for i,v in pairs(c:GetChildren()) do
  69.         if checkPart(v) then
  70.         actualESP(v)
  71.         end
  72.     end
  73.     if HEALTHBAR_ACTIVATED then
  74.         createHealthbar(c:WaitForChild("HumanoidRootPart"))
  75.     end
  76. end
  77. for i,people in pairs(players:GetChildren())do
  78.     if people ~= players.LocalPlayer then
  79.         currentPlayer = people
  80.                                                            
  81.         createESP(people.Character)
  82.             people.CharacterAdded:Connect(function(character)
  83.                 createESP(character)            
  84.             end)
  85.     end
  86. end
  87. end
  88.  
  89. createFlex()
Tags: #zsx5e
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement