Advertisement
Prokri43

Aim assist dh

Aug 10th, 2023 (edited)
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.70 KB | None | 0 0
  1. getgenv().AimPart = "Head"
  2. getgenv().AimlockKey = "v"
  3. getgenv().AimRadius = 30
  4. getgenv().ThirdPerson = true
  5. getgenv().FirstPerson = true
  6. getgenv().TeamCheck = false
  7. getgenv().PredictMovement = true
  8. getgenv().PredictionVelocity = 6.612
  9.  
  10. getgenv().AdvancedPart = true
  11. getgenv().AirShotPart = "LowerTorso"
  12.  
  13. getgenv().Smoothness = true
  14. getgenv().SmoothnessAmount = 0.0765
  15. getgenv().RemoveDelay = true
  16. getgenv().Resolver = true
  17.  
  18. local Players, Uis, RService, SGui = game:GetService"Players", game:GetService"UserInputService", game:GetService"RunService", game:GetService"StarterGui";
  19. local Client, Mouse, Camera, CF, RNew, Vec3, Vec2 = Players.LocalPlayer, Players.LocalPlayer:GetMouse(), workspace.CurrentCamera, CFrame.new, Ray.new, Vector3.new, Vector2.new;
  20. local Aimlock, MousePressed, CanNotify = true, false, false;
  21. local AimlockTarget;
  22. local OldPre;
  23.  
  24. getgenv().WorldToViewportPoint = function(P)
  25. return Camera:WorldToViewportPoint(P)
  26. end
  27.  
  28. getgenv().WorldToScreenPoint = function(P)
  29. return Camera.WorldToScreenPoint(Camera, P)
  30. end
  31.  
  32. getgenv().GetObscuringObjects = function(T)
  33. if T and T:FindFirstChild(getgenv().AimPart) and Client and Client.Character:FindFirstChild("Head") then
  34. local RayPos = workspace:FindPartOnRay(RNew(
  35. T[getgenv().AimPart].Position, Client.Character.Head.Position)
  36. )
  37. if RayPos then return RayPos:IsDescendantOf(T) end
  38. end
  39. end
  40.  
  41. getgenv().GetNearestTarget = function()
  42. local players = {}
  43. local PLAYER_HOLD = {}
  44. local DISTANCES = {}
  45. for i, v in pairs(Players:GetPlayers()) do
  46. if v ~= Client then
  47. table.insert(players, v)
  48. end
  49. end
  50. for i, v in pairs(players) do
  51. if v.Character ~= nil then
  52. local AIM = v.Character:FindFirstChild("Head")
  53. if getgenv().TeamCheck == true and v.Team ~= Client.Team then
  54. local DISTANCE = (v.Character:FindFirstChild("Head").Position - game.Workspace.CurrentCamera.CFrame.p).magnitude
  55. local RAY = Ray.new(game.Workspace.CurrentCamera.CFrame.p, (Mouse.Hit.p - game.Workspace.CurrentCamera.CFrame.p).unit * DISTANCE)
  56. local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  57. local DIFF = math.floor((POS - AIM.Position).magnitude)
  58. PLAYER_HOLD[v.Name .. i] = {}
  59. PLAYER_HOLD[v.Name .. i].dist= DISTANCE
  60. PLAYER_HOLD[v.Name .. i].plr = v
  61. PLAYER_HOLD[v.Name .. i].diff = DIFF
  62. table.insert(DISTANCES, DIFF)
  63. elseif getgenv().TeamCheck == false and v.Team == Client.Team then
  64. local DISTANCE = (v.Character:FindFirstChild("Head").Position - game.Workspace.CurrentCamera.CFrame.p).magnitude
  65. local RAY = Ray.new(game.Workspace.CurrentCamera.CFrame.p, (Mouse.Hit.p - game.Workspace.CurrentCamera.CFrame.p).unit * DISTANCE)
  66. local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  67. local DIFF = math.floor((POS - AIM.Position).magnitude)
  68. PLAYER_HOLD[v.Name .. i] = {}
  69. PLAYER_HOLD[v.Name .. i].dist= DISTANCE
  70. PLAYER_HOLD[v.Name .. i].plr = v
  71. PLAYER_HOLD[v.Name .. i].diff = DIFF
  72. table.insert(DISTANCES, DIFF)
  73. end
  74. end
  75. end
  76.  
  77. if unpack(DISTANCES) == nil then
  78. return nil
  79. end
  80.  
  81. local L_DISTANCE = math.floor(math.min(unpack(DISTANCES)))
  82. if L_DISTANCE > getgenv().AimRadius then
  83. return nil
  84. end
  85.  
  86. for i, v in pairs(PLAYER_HOLD) do
  87. if v.diff == L_DISTANCE then
  88. return v.plr
  89. end
  90. end
  91. return nil
  92. end
  93.  
  94. Mouse.KeyDown:Connect(function(a)
  95. if not (Uis:GetFocusedTextBox()) then
  96. if a == AimlockKey and AimlockTarget == nil then
  97. pcall(function()
  98. if MousePressed ~= true then MousePressed = true end
  99. local Target;Target = GetNearestTarget()
  100. if Target ~= nil then
  101. AimlockTarget = Target
  102. end
  103. end)
  104. elseif a == AimlockKey and AimlockTarget ~= nil then
  105. if AimlockTarget ~= nil then AimlockTarget = nil end
  106. if MousePressed ~= false then
  107. MousePressed = false
  108. end
  109. end
  110. end
  111. end)
  112.  
  113. RService.RenderStepped:Connect(function()
  114. if getgenv().ThirdPerson == true and getgenv().FirstPerson == true then
  115. if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude > 1 or (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 then
  116. CanNotify = true
  117. else
  118. CanNotify = false
  119. end
  120. elseif getgenv().ThirdPerson == true and getgenv().FirstPerson == false then
  121. if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude > 1 then
  122. CanNotify = true
  123. else
  124. CanNotify = false
  125. end
  126. elseif getgenv().ThirdPerson == false and getgenv().FirstPerson == true then
  127. if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 then
  128. CanNotify = true
  129. else
  130. CanNotify = false
  131. end
  132. end
  133. if Aimlock == true and MousePressed == true then
  134. if AimlockTarget and AimlockTarget.Character and AimlockTarget.Character:FindFirstChild(getgenv().AimPart) then
  135. if getgenv().FirstPerson == true then
  136. if CanNotify == true then
  137. if getgenv().PredictMovement == true then
  138. if getgenv().Smoothness == true then
  139. --// The part we're going to lerp/smoothen \\--
  140. local Main = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position + AimlockTarget.Character[getgenv().AimPart].Velocity/PredictionVelocity)
  141.  
  142. --// Making it work \\--
  143. Camera.CFrame = Camera.CFrame:Lerp(Main, getgenv().SmoothnessAmount, Enum.EasingStyle.Elastic, Enum.EasingDirection.InOut)
  144. else
  145. Camera.CFrame = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position + AimlockTarget.Character[getgenv().AimPart].Velocity/PredictionVelocity)
  146. end
  147. elseif getgenv().PredictMovement == false then
  148. if getgenv().Smoothness == true then
  149. --// The part we're going to lerp/smoothen \\--
  150. local Main = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position)
  151.  
  152. --// Making it work \\--
  153. Camera.CFrame = Camera.CFrame:Lerp(Main, getgenv().SmoothnessAmount, Enum.EasingStyle.Elastic, Enum.EasingDirection.InOut)
  154. else
  155. Camera.CFrame = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position)
  156. end
  157. end
  158. end
  159. end
  160. end
  161. end
  162. end)
  163.  
  164. RService.Heartbeat:Connect(function()
  165. if getgenv().AdvancedPart == true then
  166. if AimlockTarget and AimlockTarget.Character then
  167. if AimlockTarget.Character.Humanoid.Jump == true and AimlockTarget.Character.Humanoid.FloorMaterial == Enum.Material.Air then
  168. getgenv().AimPart = getgenv().AirShotPart
  169. else
  170. getgenv().AimPart = getgenv().AimPart
  171. end
  172. end
  173. end
  174. end)
  175.  
  176. if getgenv().RemoveDelay == true then
  177. game:GetService("CorePackages").Packages:Destroy()
  178. end
  179.  
  180. if getgenv().Resolver == true then
  181. local Target = "username"
  182. local Y = -0
  183. game:GetService("RunService").RenderStepped:Connect(function()
  184. for i,v in pairs(game.Players:GetPlayers()) do
  185. Target = v.Name
  186. if Target ~= game.Players.LocalPlayer.Name then
  187. old_vel = game.Players[Target].Character.HumanoidRootPart.Velocity
  188. game.Players[Target].Character.HumanoidRootPart.Velocity = Vector3.new(old_vel.X, Y, old_vel.Z)
  189. end
  190. end
  191. end)
  192. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement