MaxproGlitcher

TEST ESP

Aug 12th, 2024 (edited)
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.09 KB | None | 0 0
  1. local lpr = game.Players.LocalPlayer
  2. local camera = game:GetService("Workspace").CurrentCamera
  3. local worldToViewportPoint = camera.WorldToViewportPoint
  4. local userInputService = game:GetService("UserInputService")
  5.  
  6. local teamCheckActive = false
  7. local toggleKey = Enum.KeyCode.E -- Remplacez "E" par la touche souhaitée
  8.  
  9. -- Fonction permettant de générer des couleurs arc-en-ciel
  10. local function rainbowColor(frequency)
  11. local r = math.floor(math.sin(frequency + 0) * 127 + 128)
  12. local g = math.floor(math.sin(frequency + 2) * 127 + 128)
  13. local b = math.floor(math.sin(frequency + 4) * 127 + 128)
  14. return Color3.fromRGB(r, g, b)
  15. end
  16.  
  17. -- Tableaux contenant les lignes de dessin, le BillboardGui et les boîtes de frappe de chaque joueur.
  18. local playerTracers = {}
  19. local playerInfoTexts = {}
  20. local playerHitboxes = {}
  21.  
  22. -- Créer et configurer BillboardGui pour le joueur
  23. local function createBillboardGui(player)
  24. local billboardGui = Instance.new("BillboardGui", player.Character)
  25. billboardGui.Size = UDim2.new(0, 200, 0, 75)
  26. billboardGui.StudsOffset = Vector3.new(0, 3, 0)
  27. billboardGui.AlwaysOnTop = true
  28.  
  29. local nameLabel = Instance.new("TextLabel", billboardGui)
  30. nameLabel.Size = UDim2.new(1, 0, 0.33, 0)
  31. nameLabel.BackgroundTransparency = 1
  32. nameLabel.TextColor3 = rainbowColor(0)
  33. nameLabel.TextStrokeTransparency = 0
  34. nameLabel.TextSize = 14
  35. nameLabel.Text = player.Name
  36.  
  37. local distanceLabel = Instance.new("TextLabel", billboardGui)
  38. distanceLabel.Position = UDim2.new(0, 0, 0.33, 0)
  39. distanceLabel.Size = UDim2.new(1, 0, 0.33, 0)
  40. distanceLabel.BackgroundTransparency = 1
  41. distanceLabel.TextColor3 = rainbowColor(0)
  42. distanceLabel.TextStrokeTransparency = 0
  43. distanceLabel.TextSize = 14
  44.  
  45. local healthLabel = Instance.new("TextLabel", billboardGui)
  46. healthLabel.Position = UDim2.new(0, 0, 0.66, 0)
  47. healthLabel.Size = UDim2.new(1, 0, 0.33, 0)
  48. healthLabel.BackgroundTransparency = 1
  49. healthLabel.TextColor3 = rainbowColor(0)
  50. healthLabel.TextStrokeTransparency = 0
  51. healthLabel.TextSize = 14
  52.  
  53. return billboardGui, nameLabel, distanceLabel, healthLabel
  54. end
  55.  
  56. -- Mettre à jour le texte sur la distance et la santé
  57. local function updatePlayerInfo(player, distanceLabel, healthLabel, time)
  58. local rootPart = player.Character:FindFirstChild("HumanoidRootPart")
  59. if rootPart then
  60. local distance = (rootPart.Position - lpr.Character.HumanoidRootPart.Position).magnitude
  61. distanceLabel.Text = string.format("Distance : %.2f", distance)
  62. distanceLabel.TextColor3 = rainbowColor(time + player.UserId)
  63. end
  64.  
  65. local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
  66. if humanoid then
  67. local health = humanoid.Health
  68. healthLabel.Text = string.format("Santé : %.0f", health)
  69. healthLabel.TextColor3 = rainbowColor(time + player.UserId)
  70. end
  71. end
  72.  
  73. -- Créer une hitbox pour le joueur
  74. local function createHitbox()
  75. local hitbox = Drawing.new("Square")
  76. hitbox.Thickness = 2
  77. hitbox.Transparency = 1
  78. return hitbox
  79. end
  80.  
  81. -- Mise à jour des traceurs, des textes de distance et des hitboxes à chaque image
  82. local function update()
  83. local time = tick()
  84. for _, player in pairs(game.Players:GetPlayers()) do
  85. if player ~= lpr and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
  86. local rootPart = player.Character:FindFirstChild("HumanoidRootPart")
  87. local head = player.Character:FindFirstChild("Head")
  88. local screenPos, onScreen = worldToViewportPoint(camera, rootPart.Position)
  89. local headPos, headOnScreen = worldToViewportPoint(camera, head.Position)
  90.  
  91. if teamCheckActive and player.Team == lpr.Team then
  92. if playerTracers[player] then playerTracers[player].Visible = false end
  93. if playerInfoTexts[player] then playerInfoTexts[player].gui.Enabled = false end
  94. if playerHitboxes[player] then playerHitboxes[player].Visible = false end
  95. else
  96. if not playerTracers[player] then
  97. playerTracers[player] = Drawing.new("Line")
  98. end
  99. if not playerInfoTexts[player] then
  100. local billboardGui, nameLabel, distanceLabel, healthLabel = createBillboardGui(player)
  101. playerInfoTexts[player] = { gui = billboardGui, name = nameLabel, distance = distanceLabel, health = healthLabel }
  102. end
  103. if not playerHitboxes[player] then
  104. playerHitboxes[player] = createHitbox()
  105. end
  106.  
  107. local tracer = playerTracers[player]
  108. local billboardGui = playerInfoTexts[player].gui
  109. local distanceLabel = playerInfoTexts[player].distance
  110. local healthLabel = playerInfoTexts[player].health
  111. local hitbox = playerHitboxes[player]
  112.  
  113. if onScreen then
  114. tracer.From = Vector2.new(camera.ViewportSize.X / 2, camera.ViewportSize.Y)
  115. tracer.To = Vector2.new(screenPos.X, screenPos.Y)
  116. tracer.Color = rainbowColor(time + player.UserId)
  117. tracer.Thickness = 2
  118. tracer.Transparency = 1
  119. tracer.Visible = true
  120.  
  121. if headOnScreen then
  122. updatePlayerInfo(player, distanceLabel, healthLabel, time)
  123. billboardGui.Enabled = true
  124. billboardGui.StudsOffset = Vector3.new(0, 3, 0)
  125. local nameLabel = playerInfoTexts[player].name
  126. nameLabel.TextColor3 = rainbowColor(time + player.UserId)
  127.  
  128. -- Mise à jour de la hitbox
  129. local hitboxSize = (headPos - screenPos).magnitude * 2
  130. hitbox.Size = Vector2.new(hitboxSize, hitboxSize * 2.5)
  131. hitbox.Position = Vector2.new(screenPos.X - hitboxSize / 2, screenPos.Y - hitboxSize * 1.25)
  132. hitbox.Color = rainbowColor(time + player.UserId)
  133. hitbox.Visible = true
  134. else
  135. billboardGui.Enabled = false
  136. hitbox.Visible = false
  137. end
  138. else
  139. tracer.Visible = false
  140. billboardGui.Enabled = false
  141. hitbox.Visible = false
  142. end
  143. end
  144. else
  145. if playerTracers[player] then playerTracers[player].Visible = false end
  146. if playerInfoTexts[player] then playerInfoTexts[player].gui.Enabled = false end
  147. if playerHitboxes[player] then playerHitboxes[player].Visible = false end
  148. end
  149. end
  150. end
  151.  
  152. -- Fonction de gestion des nouveaux joueurs
  153. local function onPlayerAdded(player)
  154. player.CharacterAdded:Connect(function()
  155. wait(1) -- Donner au personnage le temps de se charger
  156. update()
  157. end)
  158. end
  159.  
  160. -- Connecter l'événement PlayerAdded
  161. game.Players.PlayerAdded:Connect(onPlayerAdded)
  162.  
  163. -- Mise à jour des traceurs, des textes de distance et des hitboxes à chaque image
  164. game:GetService("RunService").RenderStepped:Connect(update)
  165.  
  166. -- Nettoyer les lieux après le départ d'un joueur
  167. game.Players.PlayerRemoving:Connect(function(player)
  168. if playerTracers[player] then playerTracers[player]:Remove() playerTracers[player] = nil end
  169. if playerInfoTexts[player] then playerInfoTexts[player].gui:Destroy() playerInfoTexts[player] = nil end
  170. if playerHitboxes[player] then playerHitboxes[player]:Remove() playerHitboxes[player] = nil end
  171. end)
  172.  
  173. -- Gérer les joueurs existants
  174. for _, player in pairs(game.Players:GetPlayers()) do
  175. onPlayerAdded(player)
  176. end
  177.  
  178. -- Gestion de l'entrée utilisateur pour le basculement du contrôle d'équipe
  179. userInputService.InputBegan:Connect(function(input, gameProcessed)
  180. if not gameProcessed and input.KeyCode == toggleKey then
  181. teamCheckActive = not teamCheckActive
  182. end
  183. end)
  184.  
Advertisement
Add Comment
Please, Sign In to add comment