Advertisement
MaxproGlitcher

Block esp by Max

Mar 15th, 2024
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. -- tools in the game
  2. local tools = game.Workspace
  3.  
  4. -- like an esp (Extra Sensory Perception)
  5. local esp = Instance.new("Highlight")
  6.  
  7. -- billboard to display name
  8. local bbg = Instance.new("BillboardGui")
  9.  
  10. -- configs for the BillboardGui
  11. bbg.AlwaysOnTop = true
  12. bbg.Size = UDim2.new(0, 100, 0, 30)
  13. bbg.StudsOffset = Vector3.new(0, 2, 0)
  14.  
  15. -- table to store highlighted tools
  16. local highlightedTools = {}
  17.  
  18. -- function to highlight tools
  19. function highlightTool(item)
  20. if item:IsA("Tool") then
  21. -- check if the tool has a BoolValue named "HighlightTool"
  22. local highlightTool = item:FindFirstChild("HighlightTool")
  23. if not highlightTool then
  24. highlightTool = Instance.new("BoolValue")
  25. highlightTool.Name = "HighlightTool"
  26. highlightTool.Parent = item
  27. end
  28.  
  29. -- ignore if the tool is already highlighted
  30. if highlightTool.Value then
  31. return
  32. end
  33.  
  34. -- clone the Highlight instance and BillboardGui
  35. local copy = esp:Clone()
  36. copy.Parent = item
  37. local copy2 = bbg:Clone()
  38. copy2.Parent = item
  39.  
  40. -- create a text label for the tool name
  41. local text = Instance.new("TextLabel", copy2)
  42. text.Size = bbg.Size
  43. text.TextSize = 15
  44. text.BackgroundTransparency = 1
  45. text.Text = item.Name
  46.  
  47. -- mark the tool as highlighted
  48. highlightedTools[item] = true
  49.  
  50. -- set the bool to true
  51. highlightTool.Value = true
  52.  
  53. -- search for other tools with the same name and HighlightTool value of false
  54. for _, tool in ipairs(workspace:GetChildren()) do
  55. if tool:IsA("Tool") and tool.Name == item.Name and tool ~= item then
  56. local otherHighlightTool = tool:FindFirstChild("HighlightTool")
  57. if otherHighlightTool and otherHighlightTool:IsA("BoolValue") and not otherHighlightTool.Value then
  58. -- move the highlight to the other tool
  59. for _, child in ipairs(item:GetChildren()) do
  60. if child.Name == "Highlight" or child.Name == "BillboardGui" then
  61. child.Parent = tool
  62. end
  63. end
  64. -- update the HighlightTool value
  65. otherHighlightTool.Value = true
  66. highlightTool.Value = false
  67. break
  68. end
  69. end
  70. end
  71. end
  72. end
  73.  
  74. -- ChildAdded event
  75. workspace.ChildAdded:Connect(function(child)
  76. if child:IsA("Tool") and not highlightedTools[child] then
  77. highlightTool(child)
  78. end
  79. end)
  80.  
  81. -- function to search for tools in the workspace
  82. function search()
  83. for _, item in pairs(tools:GetDescendants()) do
  84. highlightTool(item)
  85. end
  86. end
  87.  
  88. -- connect to the Heartbeat event to search for tools
  89. game:GetService("RunService").Heartbeat:Connect(search)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement