Advertisement
Meliodas0_0

Drawing API esp + function (text only)

Jan 20th, 2020
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. esp on humanoidrootpart (supports all games where players have humanoidrootpart)
  2. Code:
  3. function WTS(part)
  4. local screen = workspace.CurrentCamera:WorldToViewportPoint(part.Position)
  5. return Vector2.new(screen.x, screen.y)
  6. end
  7.  
  8. function ESPText(part, color)
  9. local name = Drawing.new("Text")
  10. name.Text = part.Parent.Name
  11. name.Color = color
  12. name.Position = WTS(part)
  13. name.Size = 20.0
  14. name.Outline = true
  15. name.Center = true
  16. name.Visible = true
  17.  
  18. game:GetService("RunService").Stepped:connect(function()
  19. pcall(function()
  20. local destroyed = not part:IsDescendantOf(workspace)
  21. if destroyed and name ~= nil then
  22. name:Remove()
  23. end
  24. if part ~= nil then
  25. name.Position = WTS(part)
  26. end
  27. local _, screen = workspace.CurrentCamera:WorldToViewportPoint(part.Position)
  28. if screen then
  29. name.Visible = true
  30. else
  31. name.Visible = false
  32. end
  33. end)
  34. end)
  35. end
  36.  
  37. local players = game.Players:getChildren()
  38. for i=1,#players do
  39. if players[i] ~= game.Players.LocalPlayer then
  40. if players[i].Character:findFirstChild("HumanoidRootPart") then
  41. ESPText(players[i].Character.HumanoidRootPart, Color3.new(255/255,0/255,0/255))
  42. end
  43. players[i].CharacterAdded:connect(function(char)
  44. local hrp = char:WaitForChild("HumanoidRootPart")
  45. ESPText(hrp, Color3.new(255/255,0/255,0/255))
  46. end)
  47. end
  48. end
  49.  
  50. game.Players.PlayerAdded:Connect(function(plr)
  51. plr.CharacterAdded:connect(function(char)
  52. local hrp = char:WaitForChild("HumanoidRootPart")
  53. ESPText(hrp, Color3.new(255/255,0/255,0/255))
  54. end)
  55. end)
  56.  
  57.  
  58.  
  59. function
  60. Code:
  61. function WTS(part)
  62. local screen = workspace.CurrentCamera:WorldToViewportPoint(part.Position)
  63. return Vector2.new(screen.x, screen.y)
  64. end
  65.  
  66. function ESP(part, text, color)
  67. local name = Drawing.new("Text")
  68. name.Text = text
  69. name.Color = color
  70. name.Position = WTS(part)
  71. name.Size = 20.0
  72. name.Outline = true
  73. name.Center = true
  74. name.Visible = true
  75.  
  76. game:GetService("RunService").Stepped:connect(function()
  77. pcall(function()
  78. local destroyed = not part:IsDescendantOf(workspace)
  79. if destroyed and name ~= nil then
  80. name:Remove()
  81. end
  82. if part ~= nil then
  83. name.Position = WTS(part)
  84. end
  85. local _, screen = workspace.CurrentCamera:WorldToViewportPoint(part.Position)
  86. if screen then
  87. name.Visible = true
  88. else
  89. name.Visible = false
  90. end
  91. end)
  92. end)
  93. end
  94. how to use the function:
  95. Code:
  96. ESP(workspace.Part, "EPIC ESP", Color3.new(0/255,0/255,255/255))
  97. ESP(part, text, Color3.new(textcolorRED/outlinecolorRED, textcolorGREEN/outlinecolorGREEN, textcolorBLUE/outlinecolorBLUE))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement