Advertisement
sonywalker

ESP ANYGAME

Apr 30th, 2021
1,712
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.48 KB | None | 0 0
  1. -- -----------------------------------
  2. --  ___      _   _   _              --
  3. -- / __| ___| |_| |_(_)_ _  __ _ ___--
  4. -- \__ \/ -_)  _|  _| | ' \/ _` (_-<--
  5. -- |___/\___|\__|\__|_|_||_\__, /__/--
  6. --                         |___/    --
  7. -- -----------------------------------
  8. -- -----------------------------------
  9.                                 ALLYCOLOR = {0,255,255}     --//Color of the ESP  of people on the same team
  10.                                 ENEMYCOLOR =  {255,0,0}     --//Color of the ESP  of people on NOT the same team
  11.                                 TRANSPARENCY = 0.5          --//Transparency of the ESP
  12.                                 HEALTHBAR_ACTIVATED = true  --//Renders the Healthbar
  13. --
  14. --
  15.  
  16. --                          !!!Don't Change Anything Below Here Unless You Know What You're Doing!!!
  17.  
  18. function createFlex()
  19. -- -----------------------------------------------------------------------------------
  20. --[VARIABLES] //Changing may result in Errors!
  21. players = game:GetService("Players") --//Required for PF
  22. faces = {"Front","Back","Bottom","Left","Right","Top"} --//Every possible Enum face
  23. currentPlayer = nil --//Used for the Team-Check
  24. lplayer = players.LocalPlayer --//The LocalPlayer
  25. -- -----------------------------------------------------------------------------------
  26. players.PlayerAdded:Connect(function(p)
  27.     currentPlayer = p
  28.         p.CharacterAdded:Connect(function(character) --//For when a new Player joins the game
  29.             createESP(character)           
  30.         end)       
  31. end)
  32. -- -----------------------------------------------------------------------------------
  33. function checkPart(obj)  if (obj:IsA("Part") or obj:IsA("MeshPart")) and obj.Name~="HumanoidRootPart" then return true end end --//Check if the Part is suitable
  34. -- -----------------------------------------------------------------------------------
  35. function actualESP(obj)
  36.    
  37.     for i=0,5 do
  38.         surface = Instance.new("SurfaceGui",obj) --//Creates the SurfaceGui
  39.         surface.Face = Enum.NormalId[faces[i+1]] --//Adjusts the Face and chooses from the face table
  40.         surface.AlwaysOnTop = true
  41.  
  42.         frame = Instance.new("Frame",surface)   --//Creates the viewable Frame
  43.         frame.Size = UDim2.new(1,0,1,0)
  44.         frame.BorderSizePixel = 0                                              
  45.         frame.BackgroundTransparency = TRANSPARENCY
  46.             if currentPlayer.Team == players.LocalPlayer.Team then --//Checks the Players Team
  47.                     frame.BackgroundColor3 = Color3.new(ALLYCOLOR[1],ALLYCOLOR[2],ALLYCOLOR[3]) --//If in same Team                                        
  48.             else
  49.                 frame.BackgroundColor3 = Color3.new(ENEMYCOLOR[1],ENEMYCOLOR[2],ENEMYCOLOR[3])  --//If in another Team
  50.             end
  51.                                                            
  52.     end
  53. end
  54. -- -----------------------------------------------------------------------------------
  55. function createHealthbar(hrp)
  56.     board =Instance.new("BillboardGui",hrp) --//Creates the BillboardGui with HumanoidRootPart as the Parent
  57.     board.Name = "total"
  58.     board.Size = UDim2.new(1,0,1,0)
  59.     board.StudsOffset = Vector3.new(3,1,0)
  60.     board.AlwaysOnTop = true
  61.  
  62.     bar = Instance.new("Frame",board) --//Creates the red background
  63.     bar.BackgroundColor3 = Color3.new(255,0,0)
  64.     bar.BorderSizePixel = 0
  65.     bar.Size = UDim2.new(0.2,0,4,0)
  66.     bar.Name = "total2"
  67.                                                
  68.     health = Instance.new("Frame",bar) --//Creates the changing green Frame
  69.     health.BackgroundColor3 = Color3.new(0,255,0)
  70.     health.BorderSizePixel = 0
  71.     health.Size = UDim2.new(1,0,hrp.Parent.Humanoid.Health/100,0)
  72.         hrp.Parent.Humanoid.Changed:Connect(function(property) --//Triggers when any Property changed
  73.             hrp.total.total2.Frame.Size = UDim2.new(1,0,hrp.Parent.Humanoid.Health/100,0) --//Adjusts the size of the green Frame                              
  74.         end)
  75. end
  76. -- -----------------------------------------------------------------------------------
  77. function createESP(c) --//Checks and calls the proper function
  78.     bugfix = c:WaitForChild("Head") --// *Used so the children of the character arent nil.
  79.     for i,v in pairs(c:GetChildren()) do
  80.         if checkPart(v) then
  81.         actualESP(v)
  82.         end
  83.     end
  84.     if HEALTHBAR_ACTIVATED then --//If the user decided to
  85.         createHealthbar(c:WaitForChild("HumanoidRootPart")) --//Calls the function of the creation
  86.     end
  87. end
  88. -- -----------------------------------------------------------------------------------
  89. for i,people in pairs(players:GetChildren())do
  90.     if people ~= players.LocalPlayer then
  91.         currentPlayer = people
  92.                                                                 --//Used for Players already in the Game
  93.         createESP(people.Character)
  94.             people.CharacterAdded:Connect(function(character)
  95.                 createESP(character)           
  96.             end)
  97.     end
  98. end
  99. -- -----------------------------------------------------------------------------------
  100. end --//End of the entire function
  101.  
  102. createFlex() --// Does exactly that :)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement