Advertisement
trixade

Untitled

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