VenoxComeback

Untitled

Mar 8th, 2025
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. -- This script should be placed in a LocalScript
  2.  
  3. local players = game:GetService("Players")
  4. local runService = game:GetService("RunService")
  5.  
  6. -- Function to create a box around a player's character
  7. local function createESP(player)
  8. local box = Instance.new("BoxHandleAdornment")
  9. box.Name = "ESP"
  10. box.Adornee = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
  11. box.Size = player.Character and player.Character.HumanoidRootPart.Size + Vector3.new(1, 1, 1)
  12. box.Color3 = Color3.fromRGB(255, 0, 0)
  13. box.Transparency = 0.5
  14. box.AlwaysOnTop = true
  15. box.ZIndex = 10
  16. box.Parent = player.Character.HumanoidRootPart
  17. end
  18.  
  19. -- Function to remove the ESP box when the player leaves
  20. local function removeESP(player)
  21. if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
  22. local adornment = player.Character.HumanoidRootPart:FindFirstChild("ESP")
  23. if adornment then
  24. adornment:Destroy()
  25. end
  26. end
  27. end
  28.  
  29. -- Add ESP to all existing players
  30. for _, player in pairs(players:GetPlayers()) do
  31. if player ~= players.LocalPlayer then
  32. createESP(player)
  33. end
  34. end
  35.  
  36. -- Listen for new players joining and add ESP
  37. players.PlayerAdded:Connect(function(player)
  38. if player ~= players.LocalPlayer then
  39. player.CharacterAdded:Connect(function(character)
  40. createESP(player)
  41. end)
  42. end
  43. end)
  44.  
  45. -- Listen for players leaving and remove ESP
  46. players.PlayerRemoving:Connect(function(player)
  47. removeESP(player)
  48. end)
  49.  
  50. -- Keep updating ESP on RenderStepped
  51. runService.RenderStepped:Connect(function()
  52. for _, player in pairs(players:GetPlayers()) do
  53. if player ~= players.LocalPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
  54. local box = player.Character.HumanoidRootPart:FindFirstChild("ESP")
  55. if not box then
  56. createESP(player)
  57. else
  58. box.Adornee = player.Character.HumanoidRootPart
  59. end
  60. end
  61. end
  62. end)
  63.  
Add Comment
Please, Sign In to add comment