Advertisement
ThemodmenuX123456789

NAME Esp

Jan 4th, 2023
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. local c = workspace.CurrentCamera
  2. local ps = game:GetService("Players")
  3. local lp = ps.LocalPlayer
  4. local rs = game:GetService("RunService")
  5.  
  6. local function getdistancefc(part)
  7. return (part.Position - c.CFrame.Position).Magnitude
  8. end
  9.  
  10. local function esp(p,cr)
  11. local h = cr:WaitForChild("Humanoid")
  12. local hrp = cr:WaitForChild("HumanoidRootPart")
  13.  
  14. local text = Drawing.new("Text")
  15. text.Visible = false
  16. text.Center = true
  17. text.Outline = true
  18. text.Font = 2
  19. text.Color = Color3.fromRGB(255,255,255)
  20. text.Size = 16
  21.  
  22. local c1
  23. local c2
  24. local c3
  25.  
  26. local function dc()
  27. text.Visible = false
  28. text:Remove()
  29. if c1 then
  30. c1:Disconnect()
  31. c1 = nil
  32. end
  33. if c2 then
  34. c2:Disconnect()
  35. c2 = nil
  36. end
  37. if c3 then
  38. c3:Disconnect()
  39. c3 = nil
  40. end
  41. end
  42.  
  43. c2 = cr.AncestryChanged:Connect(function(_,parent)
  44. if not parent then
  45. dc()
  46. end
  47. end)
  48.  
  49. c3 = h.HealthChanged:Connect(function(v)
  50. if (v<=0) or (h:GetState() == Enum.HumanoidStateType.Dead) then
  51. dc()
  52. end
  53. end)
  54.  
  55. c1 = rs.RenderStepped:Connect(function()
  56. local hrp_pos,hrp_os = c:WorldToViewportPoint(hrp.Position)
  57. if hrp_os then
  58. text.Position = Vector2.new(hrp_pos.X,hrp_pos.Y)
  59. text.Text = p.Name .. ' ('..tostring(math.floor(getdistancefc(hrp)))..' ms)'
  60. text.Visible = true
  61. else
  62. text.Visible = false
  63. end
  64. end)
  65. end
  66.  
  67. local function p_added(p)
  68. if p.Character then
  69. esp(p,p.Character)
  70. end
  71. p.CharacterAdded:Connect(function(cr)
  72. esp(p,cr)
  73. end)
  74. end
  75.  
  76.  
  77. for i,p in next, ps:GetPlayers() do
  78. if p ~= lp then
  79. p_added(p)
  80. end
  81. end
  82.  
  83. ps.PlayerAdded:Connect(p_added)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement