ChickenBagelz

Dynamic Aimbot - General

Jul 16th, 2019
1,571
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.47 KB | None | 0 0
  1. -- Dynamic Aimbot
  2. -- Created by ChickenBagelz
  3.  
  4. local suc, err = pcall(function()
  5. if not _G.CurrentVersion then
  6. _G.CurrentVersion = 0
  7. end
  8. _G.CurrentVersion = _G.CurrentVersion + 1
  9. local LastVersion = _G.CurrentVersion
  10. local function IsUpdated()
  11. return LastVersion == _G.CurrentVersion
  12. end
  13. local function GetRayClosestPoint(ray, point)
  14. local a, b = ray.Origin - point, ray.Direction
  15. local v = a - ((a:Dot(b)) / (b:Dot(b))) * b
  16. return point + v
  17. end
  18. local Players = game:GetService("Players")
  19. local Run = game:GetService("RunService")
  20. local UIS = game:GetService("UserInputService")
  21. local plr = Players.LocalPlayer
  22. local Mouse = plr:GetMouse()
  23. local Camera = workspace.CurrentCamera
  24. local Gui = Instance.new("ScreenGui")
  25. local keybind2
  26. Gui.Name = "Chat"
  27. Gui.Parent = game.CoreGui
  28. local Msg = Instance.new("TextLabel")
  29. Msg.Text = "Press any key to set as keybind to toggle Aimbot."
  30. Msg.TextScaled = true
  31. Msg.TextWrapped = true
  32. Msg.Size = UDim2.new(0.1, 0, 0.05, 0)
  33. Msg.BackgroundTransparency = 1
  34. Msg.TextColor3 = Color3.new(1, 1, 1)
  35. Msg.TextStrokeColor3 = Color3.new()
  36. Msg.TextStrokeTransparency = 0
  37. Msg.Position = UDim2.new(0.45, 0, 0.475, 0)
  38. Msg.Parent = Gui
  39. local lerpto = CFrame.new()
  40. local limb = "HumanoidRootPart"
  41. UIS.InputBegan:Connect(function(input)
  42. if (not keybind) and input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode and IsUpdated() then
  43. keybind = input.KeyCode
  44. Msg.Text = "Toggle keybind set to "..keybind.Name.."."
  45. wait(3)
  46. Msg.Text = "Now press any key to toggle which limb to aim at."
  47. elseif keybind and (not keybind2) and input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode and IsUpdated() then
  48. keybind2 = input.KeyCode
  49. Msg.Text = "Switch limbs set to "..keybind2.Name.."."
  50. wait(3)
  51. Msg:Destroy()
  52. elseif keybind2 and UIS:IsKeyDown(keybind2) and IsUpdated() then
  53. limb = (limb == "Head" and "HumanoidRootPart" or "Head")
  54. elseif keybind and UIS:IsKeyDown(keybind) and IsUpdated() then
  55. if islooking then
  56. islooking = false
  57. else
  58. local cd, cp
  59. for i = 1, 2 do
  60. if i == 2 then
  61. cd = nil; cp = nil
  62. end
  63. local ray = Ray.new(Mouse.UnitRay.Origin, Mouse.UnitRay.Direction * 10000)
  64. for _, v in pairs(Players:GetPlayers()) do
  65. local c = v.Character
  66. if v ~= plr and c and c.PrimaryPart and c:FindFirstChild("Humanoid") and c.Humanoid.Health > 0 and ((not v.Team) or (not plr.Team) or plr.Team ~= v.Team) then
  67. local prim = c.PrimaryPart.Position
  68. local pp = GetRayClosestPoint(ray, prim)
  69. local dist = (pp - prim).magnitude
  70. if (not cp) or dist < cd then
  71. cp = v
  72. cd = dist
  73. end
  74. end
  75. end
  76. if cp and cd then
  77. lerpto = CFrame.new(Camera.CFrame.p, cp.Character[limb].Position)
  78. end
  79. end
  80. if cp and cd and lerpto then
  81. print("looking at "..cp.Name)
  82. islooking = true
  83. local alpha = 0.2
  84. while islooking and IsUpdated() and cp and cp.Character and cp.Character.PrimaryPart and cp.Character:FindFirstChild("Humanoid") and cp.Character.Humanoid.Health > 0 do
  85. Camera.CFrame = Camera.CFrame:lerp(CFrame.new(Camera.CFrame.p, cp.Character[limb].Position), alpha)
  86. alpha = math.min(alpha + 0.01, 1)
  87. Run.RenderStepped:Wait()
  88. end
  89. print("stopped")
  90. end
  91. end
  92. end
  93. end)
  94. print("Successfully executed Aimbot by ChickenBagelz: "..LastVersion)
  95. end)
  96. if not suc then
  97. print(err)
  98. end
Advertisement
Add Comment
Please, Sign In to add comment