Jack12332

ESP

Mar 17th, 2024
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.21 KB | None | 0 0
  1. local Settings = {
  2. Box_Color = Color3.fromRGB(255, 0, 0),
  3. Tracer_Color = Color3.fromRGB(255, 0, 0),
  4. Tracer_Thickness = 1,
  5. Box_Thickness = 1,
  6. Tracer_Origin = "Bottom", -- Middle or Bottom if FollowMouse is on this won't matter...
  7. Tracer_FollowMouse = false,
  8. Tracers = false
  9. }
  10. local Team_Check = {
  11. TeamCheck = true, -- if TeamColor is on this won't matter...
  12. Green = Color3.fromRGB(0, 255, 0),
  13. Red = Color3.fromRGB(255, 0, 0)
  14. }
  15. local TeamColor = true
  16.  
  17. --// SEPARATION
  18. local player = game:GetService("Players").LocalPlayer
  19. local camera = game:GetService("Workspace").CurrentCamera
  20. local mouse = player:GetMouse()
  21.  
  22. local function NewQuad(thickness, color)
  23. local quad = Drawing.new("Quad")
  24. quad.Visible = false
  25. quad.PointA = Vector2.new(0,0)
  26. quad.PointB = Vector2.new(0,0)
  27. quad.PointC = Vector2.new(0,0)
  28. quad.PointD = Vector2.new(0,0)
  29. quad.Color = color
  30. quad.Filled = false
  31. quad.Thickness = thickness
  32. quad.Transparency = 1
  33. return quad
  34. end
  35.  
  36. local function NewLine(thickness, color)
  37. local line = Drawing.new("Line")
  38. line.Visible = false
  39. line.From = Vector2.new(0, 0)
  40. line.To = Vector2.new(0, 0)
  41. line.Color = color
  42. line.Thickness = thickness
  43. line.Transparency = 1
  44. return line
  45. end
  46.  
  47. local function Visibility(state, lib)
  48. for u, x in pairs(lib) do
  49. x.Visible = state
  50. end
  51. end
  52.  
  53. local function ToColor3(col) --Function to convert, just cuz c;
  54. local r = col.r --Red value
  55. local g = col.g --Green value
  56. local b = col.b --Blue value
  57. return Color3.new(r,g,b); --Color3 datatype, made of the RGB inputs
  58. end
  59.  
  60. local black = Color3.fromRGB(0, 0 ,0)
  61. local function ESP(plr)
  62. local library = {
  63. --//Tracer and Black Tracer(black border)
  64. blacktracer = NewLine(Settings.Tracer_Thickness*2, black),
  65. tracer = NewLine(Settings.Tracer_Thickness, Settings.Tracer_Color),
  66. --//Box and Black Box(black border)
  67. black = NewQuad(Settings.Box_Thickness*2, black),
  68. box = NewQuad(Settings.Box_Thickness, Settings.Box_Color),
  69. --//Bar and Green Health Bar (part that moves up/down)
  70. healthbar = NewLine(3, black),
  71. greenhealth = NewLine(1.5, black)
  72. }
  73.  
  74. local function Colorize(color)
  75. for u, x in pairs(library) do
  76. if x ~= library.healthbar and x ~= library.greenhealth and x ~= library.blacktracer and x ~= library.black then
  77. x.Color = color
  78. end
  79. end
  80. end
  81.  
  82. local function Updater()
  83. local connection
  84. connection = game:GetService("RunService").RenderStepped:Connect(function()
  85. if plr.Character ~= nil and plr.Character:FindFirstChild("Humanoid") ~= nil and plr.Character:FindFirstChild("HumanoidRootPart") ~= nil and plr.Character.Humanoid.Health > 0 and plr.Character:FindFirstChild("Head") ~= nil then
  86. local HumPos, OnScreen = camera:WorldToViewportPoint(plr.Character.HumanoidRootPart.Position)
  87. if OnScreen then
  88. local head = camera:WorldToViewportPoint(plr.Character.Head.Position)
  89. local DistanceY = math.clamp((Vector2.new(head.X, head.Y) - Vector2.new(HumPos.X, HumPos.Y)).magnitude, 2, math.huge)
  90.  
  91. local function Size(item)
  92. item.PointA = Vector2.new(HumPos.X + DistanceY, HumPos.Y - DistanceY*2)
  93. item.PointB = Vector2.new(HumPos.X - DistanceY, HumPos.Y - DistanceY*2)
  94. item.PointC = Vector2.new(HumPos.X - DistanceY, HumPos.Y + DistanceY*2)
  95. item.PointD = Vector2.new(HumPos.X + DistanceY, HumPos.Y + DistanceY*2)
  96. end
  97. Size(library.box)
  98. Size(library.black)
  99.  
  100. --//Tracer
  101. if Settings.Tracers then
  102. if Settings.Tracer_Origin == "Middle" then
  103. library.tracer.From = camera.ViewportSize*0.5
  104. library.blacktracer.From = camera.ViewportSize*0.5
  105. elseif Settings.Tracer_Origin == "Bottom" then
  106. library.tracer.From = Vector2.new(camera.ViewportSize.X*0.5, camera.ViewportSize.Y)
  107. library.blacktracer.From = Vector2.new(camera.ViewportSize.X*0.5, camera.ViewportSize.Y)
  108. end
  109. if Settings.Tracer_FollowMouse then
  110. library.tracer.From = Vector2.new(mouse.X, mouse.Y+36)
  111. library.blacktracer.From = Vector2.new(mouse.X, mouse.Y+36)
  112. end
  113. library.tracer.To = Vector2.new(HumPos.X, HumPos.Y + DistanceY*2)
  114. library.blacktracer.To = Vector2.new(HumPos.X, HumPos.Y + DistanceY*2)
  115. else
  116. library.tracer.From = Vector2.new(0, 0)
  117. library.blacktracer.From = Vector2.new(0, 0)
  118. library.tracer.To = Vector2.new(0, 0)
  119. library.blacktracer.To = Vector2.new(0, 02)
  120. end
  121.  
  122. --// Health Bar
  123. local d = (Vector2.new(HumPos.X - DistanceY, HumPos.Y - DistanceY*2) - Vector2.new(HumPos.X - DistanceY, HumPos.Y + DistanceY*2)).magnitude
  124. local healthoffset = plr.Character.Humanoid.Health/plr.Character.Humanoid.MaxHealth * d
  125.  
  126. library.greenhealth.From = Vector2.new(HumPos.X - DistanceY - 4, HumPos.Y + DistanceY*2)
  127. library.greenhealth.To = Vector2.new(HumPos.X - DistanceY - 4, HumPos.Y + DistanceY*2 - healthoffset)
  128.  
  129. library.healthbar.From = Vector2.new(HumPos.X - DistanceY - 4, HumPos.Y + DistanceY*2)
  130. library.healthbar.To = Vector2.new(HumPos.X - DistanceY - 4, HumPos.Y - DistanceY*2)
  131.  
  132. local green = Color3.fromRGB(0, 255, 0)
  133. local red = Color3.fromRGB(255, 0, 0)
  134.  
  135. library.greenhealth.Color = red:lerp(green, plr.Character.Humanoid.Health/plr.Character.Humanoid.MaxHealth);
  136.  
  137. if Team_Check.TeamCheck then
  138. if plr.TeamColor == player.TeamColor then
  139. Colorize(Team_Check.Green)
  140. else
  141. Colorize(Team_Check.Red)
  142. end
  143. else
  144. library.tracer.Color = Settings.Tracer_Color
  145. library.box.Color = Settings.Box_Color
  146. end
  147. if TeamColor == true then
  148. Colorize(plr.TeamColor.Color)
  149. end
  150. Visibility(true, library)
  151. else
  152. Visibility(false, library)
  153. end
  154. else
  155. Visibility(false, library)
  156. if game.Players:FindFirstChild(plr.Name) == nil then
  157. connection:Disconnect()
  158. end
  159. end
  160. end)
  161. end
  162. coroutine.wrap(Updater)()
  163. end
  164.  
  165. for i, v in pairs(game:GetService("Players"):GetPlayers()) do
  166. if v.Name ~= player.Name then
  167. coroutine.wrap(ESP)(v)
  168. end
  169. end
  170.  
  171. game.Players.PlayerAdded:Connect(function(newplr)
  172. if newplr.Name ~= player.Name then
  173. coroutine.wrap(ESP)(newplr)
  174. end
  175. end)
  176.  
  177. local c = workspace.CurrentCamera
  178. local ps = game:GetService("Players")
  179. local lp = ps.LocalPlayer
  180. local rs = game:GetService("RunService")
  181.  
  182. local function esp(p,cr)
  183. local h = cr:WaitForChild("Humanoid")
  184. local hrp = cr:WaitForChild("HumanoidRootPart")
  185.  
  186. local text = Drawing.new("Text")
  187. text.Visible = false
  188. text.Center = true
  189. text.Outline = false
  190. text.Font = 2
  191. text.Color = Color3.fromRGB(255,255,255)
  192. text.Size = 13
  193.  
  194. local c1
  195. local c2
  196. local c3
  197.  
  198. local function dc()
  199. text.Visible = false
  200. text:Remove()
  201. if c1 then
  202. c1:Disconnect()
  203. c1 = nil
  204. end
  205. if c2 then
  206. c2:Disconnect()
  207. c2 = nil
  208. end
  209. if c3 then
  210. c3:Disconnect()
  211. c3 = nil
  212. end
  213. end
  214.  
  215. c2 = cr.AncestryChanged:Connect(function(_,parent)
  216. if not parent then
  217. dc()
  218. end
  219. end)
  220.  
  221. c3 = h.HealthChanged:Connect(function(v)
  222. if (v<=0) or (h:GetState() == Enum.HumanoidStateType.Dead) then
  223. dc()
  224. end
  225. end)
  226.  
  227. c1 = rs.RenderStepped:Connect(function()
  228. local hrp_pos,hrp_onscreen = c:WorldToViewportPoint(hrp.Position)
  229. if hrp_onscreen then
  230. text.Position = Vector2.new(hrp_pos.X, hrp_pos.Y)
  231. text.Text = p.Name
  232. text.Visible = true
  233. else
  234. text.Visible = false
  235. end
  236. end)
  237. end
  238.  
  239. local function p_added(p)
  240. if p.Character then
  241. esp(p,p.Character)
  242. end
  243. p.CharacterAdded:Connect(function(cr)
  244. esp(p,cr)
  245. end)
  246. end
  247.  
  248. for i,p in next, ps:GetPlayers() do
  249. if p ~= lp then
  250. p_added(p)
  251. end
  252. end
  253.  
  254. ps.PlayerAdded:Connect(p_added)
Add Comment
Please, Sign In to add comment