Advertisement
NotExotic

Esp for bob ui

Sep 15th, 2023
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. print("Esp")
  2. -- Function to create a hitbox for a character
  3. local function createHitbox(character)
  4. for _, part in pairs(character:GetChildren()) do
  5. if part:IsA("BasePart") then
  6. local hitbox = part:FindFirstChild("Hitbox")
  7. if not hitbox then
  8. hitbox = Instance.new("SelectionBox")
  9. hitbox.Name = "Hitbox"
  10. hitbox.Adornee = part
  11. hitbox.Parent = part
  12. hitbox.Color3 = Color3.new(1, 0, 0) -- Set the hitbox color (red in this example)
  13. hitbox.LineThickness = 0.05 -- Adjust the hitbox thickness as needed
  14. end
  15. end
  16. end
  17. end
  18.  
  19. -- Function to remove hitboxes from a character
  20. local function removeHitbox(character)
  21. for _, part in pairs(character:GetChildren()) do
  22. if part:IsA("BasePart") then
  23. local hitbox = part:FindFirstChild("Hitbox")
  24. if hitbox then
  25. hitbox:Destroy()
  26. end
  27. end
  28. end
  29. end
  30.  
  31. -- Function to draw hitboxes for a player
  32. local function drawPlayerHitbox(player)
  33. local character = player.Character
  34. if character then
  35. createHitbox(character)
  36. end
  37. end
  38.  
  39. -- Function to handle player character changes
  40. local function onCharacterAdded(character)
  41. createHitbox(character)
  42. end
  43.  
  44. local function onCharacterRemoved(character)
  45. removeHitbox(character)
  46. end
  47.  
  48. -- Function to continuously check for new players and draw their hitboxes
  49. local function checkForNewPlayers()
  50. while true do
  51. for _, player in pairs(game:GetService("Players"):GetPlayers()) do
  52. drawPlayerHitbox(player)
  53. end
  54. wait(1) -- Adjust the delay as needed (1 second in this example)
  55. end
  56. end
  57.  
  58. -- Start the loop in a separate thread to avoid script termination
  59. spawn(checkForNewPlayers)
  60.  
  61. -- Connect an event to draw hitboxes for newly added players
  62. game:GetService("Players").PlayerAdded:Connect(function(player)
  63. player.CharacterAdded:Connect(onCharacterAdded)
  64. player.CharacterRemoving:Connect(onCharacterRemoved)
  65. drawPlayerHitbox(player)
  66. end)
  67.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement