kphs2

PHANTOM AIMBOT

Sep 14th, 2024
4,881
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.59 KB | None | 0 0
  1. --// aimbot version (mouse api required)
  2. --// vars
  3.  
  4. local players = workspace.Players
  5. local camera = workspace.CurrentCamera
  6.  
  7. --// services
  8.  
  9. local run_service = game:GetService("RunService")
  10. local teams = game:GetService("Teams")
  11. local plr_service = game:GetService("Players")
  12. local user_input_service = game:GetService("UserInputService")
  13.  
  14. --// tables
  15.  
  16. local features = { --// aimbot speed is mouse sensitivity dependent (not dpi)
  17. aimbot = {enabled = true, fov = 150, speed = 8, hitpart = "head"},
  18. chams = {enabled = true, color = {fill = Color3.fromRGB(121, 106, 255), outline = Color3.fromRGB(119, 121, 255)}, transparency = {fill = 0, outline = 0}},
  19. }
  20.  
  21. --// instances
  22.  
  23. local fov_circle = Drawing.new("Circle")
  24. fov_circle.Color = Color3.fromRGB(255, 255, 255)
  25. fov_circle.Radius = features.aimbot.fov
  26. fov_circle.Visible = true
  27.  
  28. --// functions
  29.  
  30. function is_ally(player)
  31.  
  32. if not player then
  33. return false
  34. end
  35.  
  36. local helmet = player:FindFirstChildWhichIsA("Folder") and player:FindFirstChildWhichIsA("Folder"):FindFirstChildOfClass("MeshPart")
  37. if not helmet then
  38. return false
  39. end
  40.  
  41. if helmet.BrickColor == BrickColor.new("Black") then
  42. return teams.Phantoms == plr_service.LocalPlayer.Team
  43. end
  44.  
  45. return teams.Ghosts == plr_service.LocalPlayer.Team
  46.  
  47. end
  48.  
  49. function get_players()
  50. local entity_list = {}
  51.  
  52. for _, team in players:GetChildren() do
  53. for _, player in team:GetChildren() do
  54. if player:IsA("Model") and not is_ally(player) then
  55. entity_list[#entity_list+1] = player
  56. end
  57. end
  58. end
  59.  
  60. return entity_list
  61. end
  62.  
  63. function add_chams(adornee)
  64.  
  65. local highlight = Instance.new("Highlight", adornee)
  66.  
  67. highlight.FillColor = features.chams.color.fill
  68. highlight.OutlineColor = features.chams.color.outline
  69. highlight.FillTransparency = features.chams.transparency.fill
  70. highlight.OutlineTransparency = features.chams.transparency.outline
  71.  
  72. end
  73.  
  74. function get_character(player) --// shitty optimization but indexing just fucking returns a folder for some reason
  75. local char = {
  76. head = nil,
  77. torso = nil,
  78. }
  79.  
  80. for _, bodypart in player:GetChildren() do
  81. if bodypart:IsA("BasePart") or bodypart:IsA("MeshPart") then
  82. if bodypart.Size == Vector3.new(1, 1, 1) then
  83. char.head = bodypart
  84. elseif bodypart.Size == Vector3.new(2, 2, 1) then
  85. char.torso = bodypart
  86. end
  87. end
  88. end
  89.  
  90. return char
  91. end
  92.  
  93. function get_closest_player()
  94. local closest = nil
  95. local closest_dist = math.huge
  96.  
  97. for _, player in get_players() do
  98. if player then
  99.  
  100. local character = get_character(player)
  101.  
  102. if character and character.torso then
  103. local w2s, onscreen = camera:WorldToViewportPoint(character.torso.Position)
  104. if onscreen then
  105.  
  106. local dist = (Vector2.new(w2s.X, w2s.Y) - Vector2.new(camera.ViewportSize.X / 2, camera.ViewportSize.Y / 2)).Magnitude
  107. if dist < features.aimbot.fov and dist < closest_dist then
  108. closest = player
  109. closest_dist = dist
  110. end
  111.  
  112. end
  113. end
  114.  
  115. end
  116. end
  117.  
  118. return closest
  119. end
  120.  
  121. --// logic
  122.  
  123. run_service.RenderStepped:Connect(function(delta)
  124. for _, player in get_players() do
  125.  
  126. if features.aimbot.enabled and user_input_service:IsMouseButtonPressed(Enum.UserInputType.MouseButton2) then
  127.  
  128. local closest = get_closest_player()
  129. if closest then
  130.  
  131. local character = get_character(closest)
  132. local hitpart = character[features.aimbot.hitpart]
  133.  
  134. if character and hitpart then
  135. local w2s = camera:WorldToViewportPoint(hitpart.Position)
  136. local mouse = user_input_service:GetMouseLocation()
  137. local speed = features.aimbot.speed / 10
  138.  
  139. mousemoverel((w2s.X - mouse.X) * speed, (w2s.Y - mouse.Y) * speed) --// mmm i love it!
  140. end
  141.  
  142. end
  143.  
  144. end
  145.  
  146. if player and player:FindFirstChildWhichIsA("Model") and not player:FindFirstChildWhichIsA("Highlight") then
  147. if features.chams.enabled then
  148. add_chams(player)
  149. end
  150. end
  151.  
  152. end
  153.  
  154. fov_circle.Position = Vector2.new(camera.ViewportSize.X / 2, camera.ViewportSize.Y / 2)
  155. end)
Add Comment
Please, Sign In to add comment