Advertisement
YESSIR455bb

Really simple ESP script

Apr 29th, 2025
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.54 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local RunService = game:GetService("RunService")
  3. local LocalPlayer = Players.LocalPlayer
  4. local Camera = workspace.CurrentCamera
  5.  
  6. local ESP = {}
  7. local Tracers = {}
  8. local NameTags = {}
  9.  
  10. RunService.RenderStepped:Connect(function()
  11. for _, player in pairs(Players:GetPlayers()) do
  12. if player ~= LocalPlayer then
  13. local character = player.Character
  14. local hrp = character and character:FindFirstChild("HumanoidRootPart")
  15. local humanoid = character and character:FindFirstChild("Humanoid")
  16. local head = character and character:FindFirstChild("Head")
  17.  
  18. if hrp and humanoid and humanoid.Health > 0 then
  19. local pos, onScreen = Camera:WorldToViewportPoint(hrp.Position)
  20.  
  21. if onScreen then
  22. -- Create ESP box if it doesn't exist
  23. if not ESP[player] then
  24. local box = Drawing.new("Square")
  25. box.Thickness = 2
  26. box.Color = Color3.new(1, 0, 0)
  27. box.Transparency = 1
  28. box.Filled = false
  29. ESP[player] = box
  30. end
  31.  
  32. -- Create Tracer if it doesn't exist
  33. if not Tracers[player] then
  34. local line = Drawing.new("Line")
  35. line.Thickness = 1
  36. line.Color = Color3.new(1, 0, 0)
  37. line.Transparency = 1
  38. Tracers[player] = line
  39. end
  40.  
  41. -- Create NameTag with black box if it doesn't exist
  42. if not NameTags[player] then
  43. local nameBox = Drawing.new("Square")
  44. nameBox.Thickness = 2
  45. nameBox.Color = Color3.new(0, 0, 0) -- Black background for the name
  46. nameBox.Filled = true
  47. NameTags[player] = {Box = nameBox, Text = Drawing.new("Text")}
  48. NameTags[player].Text.Size = 16
  49. NameTags[player].Text.Color = Color3.new(1, 1, 1) -- White text color
  50. NameTags[player].Text.Transparency = 1
  51. NameTags[player].Text.Center = true
  52. NameTags[player].Text.Outline = true
  53. NameTags[player].Text.OutlineColor = Color3.new(0, 0, 0) -- Black outline for readability
  54. end
  55.  
  56. -- Set size and position for ESP box
  57. local scaleFactor = 3
  58. local sizeY = 5 * scaleFactor
  59. local sizeX = 2 * scaleFactor
  60. ESP[player].Size = Vector2.new(sizeX, sizeY)
  61. ESP[player].Position = Vector2.new(pos.X - sizeX / 2, pos.Y - sizeY / 2)
  62. ESP[player].Visible = true
  63.  
  64. -- Set Tracer line
  65. Tracers[player].From = Vector2.new(Camera.ViewportSize.X / 2, Camera.ViewportSize.Y / 2)
  66. Tracers[player].To = Vector2.new(pos.X, pos.Y)
  67. Tracers[player].Visible = true
  68.  
  69. -- Set NameTag with black box directly behind the name
  70. if head then
  71. local namePos, nameOnScreen = Camera:WorldToViewportPoint(head.Position + Vector3.new(0, 2, 0)) -- Adjusted for name above head
  72. if nameOnScreen then
  73. local textWidth = NameTags[player].Text.TextBounds.X
  74. local textHeight = NameTags[player].Text.TextBounds.Y
  75.  
  76. -- Position the name box behind the text (ensure it's below the name text)
  77. NameTags[player].Box.Size = Vector2.new(textWidth + 10, textHeight + 5)
  78. NameTags[player].Box.Position = Vector2.new(namePos.X - (textWidth / 2) - 5, namePos.Y - (textHeight / 2) + 5) -- Box placed below the text
  79.  
  80. -- Position the name text correctly in front of the box
  81. NameTags[player].Text.Text = player.Name
  82. NameTags[player].Text.Position = Vector2.new(namePos.X, namePos.Y)
  83. NameTags[player].Box.Visible = true
  84. NameTags[player].Text.Visible = true
  85. else
  86. NameTags[player].Box.Visible = false
  87. NameTags[player].Text.Visible = false
  88. end
  89. end
  90. else
  91. if ESP[player] then ESP[player].Visible = false end
  92. if Tracers[player] then Tracers[player].Visible = false end
  93. if NameTags[player] then
  94. NameTags[player].Box.Visible = false
  95. NameTags[player].Text.Visible = false
  96. end
  97. end
  98. else
  99. -- Remove ESP, Tracers, and NameTags if player dies or no valid character
  100. if ESP[player] then ESP[player]:Remove(); ESP[player] = nil end
  101. if Tracers[player] then Tracers[player]:Remove(); Tracers[player] = nil end
  102. if NameTags[player] then
  103. NameTags[player].Box:Remove()
  104. NameTags[player].Text:Remove()
  105. NameTags[player] = nil
  106. end
  107. end
  108. end
  109. end
  110. end)
  111.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement