Advertisement
Guest User

Untitled

a guest
Oct 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.80 KB | None | 0 0
  1. -- ## silent aimbot for ffa games written by aze#6678
  2. -- ## only works for protosmasher, undetectable by almost every game
  3. -- ## team dm aimbot coming soon!
  4.  
  5. local getOurHead = function() -- make it dynamic so it works after we respawn
  6. if game:GetService("Players").LocalPlayer.Character.Head then -- if we're alive
  7. return game:GetService("Players").LocalPlayer.Character.Head.Position -- return the head position
  8. else
  9. return nil -- return nothing
  10. end
  11. end
  12.  
  13. function getNearestCharacterToUs()
  14. local smallestPositionFound = math.huge -- log the smallest position to us found yet
  15. local nearestPlayerRightNow = nil -- we haven't found anything yet, so just set this to nil for now.
  16. for i, player in pairs(game:GetService("Players"):GetPlayers()) do -- get all players in the game and loop through them
  17. if player ~= game:GetService("Players").LocalPlayer then -- check if the player is not localplayer (if its not us)
  18. if player.Character then -- check if their character exists (or if they're dead, spectating or choosing loadout, or doing something else)
  19. local distanceFromUs = player:DistanceFromCharacter(getOurHead() or Vector3.new(0,0,0)) -- calculate distance from our head or 0, 0, 0 (if our head doesn't exist)
  20. if distanceFromUs < smallestPositionFound then -- if the player we found is closer than the closest player then
  21. smallestPositionFound = distanceFromUs -- log the position of the closest player
  22. nearestPlayerRightNow = player.Character -- log the character closest to us
  23. end
  24. end
  25. end
  26. end
  27. return nearestPlayerRightNow -- return the closest character to our character
  28. end
  29.  
  30. -- so if we were to do print(getNearestCharacterToUs().Name)) it would print the name of the player that's closest to our character right now.
  31. -- we can get the position of the closest character using getNearestCharacterToUs.Position
  32. -- so, now we know the position of the closest character to us, we can start aiming at him.
  33. local camera = workspace.CurrentCamera
  34. function WorldToScreen(Position)
  35. return camera:WorldToScreenPoint(Position) -- voila! now we have the position that we want to move our mouse on.
  36. end
  37.  
  38. local mouse = game:GetService("Players").LocalPlayer:GetMouse()
  39. local smoothness = 2
  40. local delay = 0.033
  41. function actuallyAim()
  42. if getNearestCharacterToUs().Head then -- see if the character's head exists first
  43. local aimAt = WorldToScreen(getNearestCharacterToUs().Head.Position) -- get the Vector2 coordinates of the target
  44. local mouseLocation = WorldToScreen(mouse.Hit.p)
  45. local incrementX, incrementY = (aimAt.X - mouseLocation.X) / smoothness, (aimAt.Y - mouseLocation.Y) / smoothness -- calculate the increments according to smoothness
  46. for i = 1, smoothness do -- hey, we already described this before!
  47. Input.MoveMouse(incrementX, incrementY) -- move the mouse 1/smoothness of the way
  48. wait (delay) -- or you can use game:GetService("RunService").RenderStepped:Wait() OR you can remove this line to make the aimbot snap instantly on your victims
  49. end
  50. end
  51. end
  52.  
  53. local toggled = false
  54. local keybind = "g" -- customize the keybind to enable and disable the aimbot
  55. mouse.KeyDown:Connect(function(key)
  56. if key == keybind then
  57. if toggled then -- if its enabled then disable it
  58. toggled = false
  59. print "disabled silent aimbot!"
  60. else -- if its disabled enable it
  61. toggled = true
  62. print "enabled silent aimbot!"
  63. end
  64. end
  65. end)
  66.  
  67. while wait (delay * smoothness) do -- very important part
  68. if toggled then -- if the aimbot is toggled, if it is
  69. actuallyAim() -- aim at the player
  70. end
  71. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement