Advertisement
Ritual_x

DA HOOD OP CUSTOMIZABLE CAMLOCK (PASTEBIN)

Mar 3rd, 2023
4,227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.38 KB | None | 0 0
  1. getgenv().OldAimPart = "HumanoidRootPart"
  2. getgenv().AimPart = "HumanoidRootPart" -- For R15 Games: {UpperTorso, LowerTorso, HumanoidRootPart, Head} | For R6 Games: {Head, Torso, HumanoidRootPart}
  3. getgenv().AimlockKey = "e"
  4. getgenv().AimRadius = 50 -- How far away from someones character you want to lock on at
  5. getgenv().ThirdPerson = true
  6. getgenv().FirstPerson = true
  7. getgenv().TeamCheck = false -- Check if Target is on your Team (True means it wont lock onto your teamates, false is vice versa) (Set it to false if there are no teams)
  8. getgenv().PredictMovement = true -- Predicts if they are moving in fast velocity (like jumping) so the aimbot will go a bit faster to match their speed
  9. getgenv().PredictionVelocity = 6.612
  10. getgenv().CheckIfJumped = true
  11. getgenv().Smoothness = false
  12. getgenv().SmoothnessAmount = 0.2
  13.  
  14. local Players, Uis, RService, SGui = game:GetService"Players", game:GetService"UserInputService", game:GetService"RunService", game:GetService"StarterGui";
  15. local Client, Mouse, Camera, CF, RNew, Vec3, Vec2 = Players.LocalPlayer, Players.LocalPlayer:GetMouse(), workspace.CurrentCamera, CFrame.new, Ray.new, Vector3.new, Vector2.new;
  16. local Aimlock, MousePressed, CanNotify = true, false, false;
  17. local AimlockTarget;
  18. local OldPre;
  19.  
  20.  
  21.  
  22. getgenv().WorldToViewportPoint = function(P)
  23. return Camera:WorldToViewportPoint(P)
  24. end
  25.  
  26. getgenv().WorldToScreenPoint = function(P)
  27. return Camera.WorldToScreenPoint(Camera, P)
  28. end
  29.  
  30. getgenv().GetObscuringObjects = function(T)
  31. if T and T:FindFirstChild(getgenv().AimPart) and Client and Client.Character:FindFirstChild("Head") then
  32. local RayPos = workspace:FindPartOnRay(RNew(
  33. T[getgenv().AimPart].Position, Client.Character.Head.Position)
  34. )
  35. if RayPos then return RayPos:IsDescendantOf(T) end
  36. end
  37. end
  38.  
  39. getgenv().GetNearestTarget = function()
  40. -- Credits to whoever made this, i didnt make it, and my own mouse2plr function kinda sucks
  41. local players = {}
  42. local PLAYER_HOLD = {}
  43. local DISTANCES = {}
  44. for i, v in pairs(Players:GetPlayers()) do
  45. if v ~= Client then
  46. table.insert(players, v)
  47. end
  48. end
  49. for i, v in pairs(players) do
  50. if v.Character ~= nil then
  51. local AIM = v.Character:FindFirstChild("Head")
  52. if getgenv().TeamCheck == true and v.Team ~= Client.Team then
  53. local DISTANCE = (v.Character:FindFirstChild("Head").Position - game.Workspace.CurrentCamera.CFrame.p).magnitude
  54. local RAY = Ray.new(game.Workspace.CurrentCamera.CFrame.p, (Mouse.Hit.p - game.Workspace.CurrentCamera.CFrame.p).unit * DISTANCE)
  55. local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  56. local DIFF = math.floor((POS - AIM.Position).magnitude)
  57. PLAYER_HOLD[v.Name .. i] = {}
  58. PLAYER_HOLD[v.Name .. i].dist= DISTANCE
  59. PLAYER_HOLD[v.Name .. i].plr = v
  60. PLAYER_HOLD[v.Name .. i].diff = DIFF
  61. table.insert(DISTANCES, DIFF)
  62. elseif getgenv().TeamCheck == false and v.Team == Client.Team then
  63. local DISTANCE = (v.Character:FindFirstChild("Head").Position - game.Workspace.CurrentCamera.CFrame.p).magnitude
  64. local RAY = Ray.new(game.Workspace.CurrentCamera.CFrame.p, (Mouse.Hit.p - game.Workspace.CurrentCamera.CFrame.p).unit * DISTANCE)
  65. local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  66. local DIFF = math.floor((POS - AIM.Position).magnitude)
  67. PLAYER_HOLD[v.Name .. i] = {}
  68. PLAYER_HOLD[v.Name .. i].dist= DISTANCE
  69. PLAYER_HOLD[v.Name .. i].plr = v
  70. PLAYER_HOLD[v.Name .. i].diff = DIFF
  71. table.insert(DISTANCES, DIFF)
  72. end
  73. end
  74. end
  75.  
  76. if unpack(DISTANCES) == nil then
  77. return nil
  78. end
  79.  
  80. local L_DISTANCE = math.floor(math.min(unpack(DISTANCES)))
  81. if L_DISTANCE > getgenv().AimRadius then
  82. return nil
  83. end
  84.  
  85. for i, v in pairs(PLAYER_HOLD) do
  86. if v.diff == L_DISTANCE then
  87. return v.plr
  88. end
  89. end
  90. return nil
  91. end
  92.  
  93. Mouse.KeyDown:Connect(function(a)
  94. if not (Uis:GetFocusedTextBox()) then
  95. if a == AimlockKey and AimlockTarget == nil then
  96. pcall(function()
  97. if MousePressed ~= true then MousePressed = true end
  98. local Target;Target = GetNearestTarget()
  99. if Target ~= nil then
  100. AimlockTarget = Target
  101. end
  102. end)
  103. elseif a == AimlockKey and AimlockTarget ~= nil then
  104. if AimlockTarget ~= nil then AimlockTarget = nil end
  105. if MousePressed ~= false then
  106. MousePressed = false
  107. end
  108. end
  109. end
  110. end)
  111.  
  112. RService.RenderStepped:Connect(function()
  113. if getgenv().ThirdPerson == true and getgenv().FirstPerson == true then
  114. if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude > 1 or (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 then
  115. CanNotify = true
  116. else
  117. CanNotify = false
  118. end
  119. elseif getgenv().ThirdPerson == true and getgenv().FirstPerson == false then
  120. if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude > 1 then
  121. CanNotify = true
  122. else
  123. CanNotify = false
  124. end
  125. elseif getgenv().ThirdPerson == false and getgenv().FirstPerson == true then
  126. if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 then
  127. CanNotify = true
  128. else
  129. CanNotify = false
  130. end
  131. end
  132. if Aimlock == true and MousePressed == true then
  133. if AimlockTarget and AimlockTarget.Character and AimlockTarget.Character:FindFirstChild(getgenv().AimPart) then
  134. if getgenv().FirstPerson == true then
  135. if CanNotify == true then
  136. if getgenv().PredictMovement == true then
  137. if getgenv().Smoothness == true then
  138. --// The part we're going to lerp/smoothen \\--
  139. local Main = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position + AimlockTarget.Character[getgenv().AimPart].Velocity/PredictionVelocity)
  140.  
  141. --// Making it work \\--
  142. Camera.CFrame = Camera.CFrame:Lerp(Main, getgenv().SmoothnessAmount, Enum.EasingStyle.Elastic, Enum.EasingDirection.InOut)
  143. else
  144. Camera.CFrame = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position + AimlockTarget.Character[getgenv().AimPart].Velocity/PredictionVelocity)
  145. end
  146. elseif getgenv().PredictMovement == false then
  147. if getgenv().Smoothness == true then
  148. --// The part we're going to lerp/smoothen \\--
  149. local Main = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position)
  150.  
  151. --// Making it work \\--
  152. Camera.CFrame = Camera.CFrame:Lerp(Main, getgenv().SmoothnessAmount, Enum.EasingStyle.Elastic, Enum.EasingDirection.InOut)
  153. else
  154. Camera.CFrame = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position)
  155. end
  156. end
  157. end
  158. end
  159. end
  160. end
  161. if CheckIfJumped == true then
  162. if AimlockTarget.Character.HuDDDDDDDDDDWmanoid.FloorMaterial == Enum.Material.Air then
  163.  
  164. getgenv().AimPart = "HumanoidRootPart"
  165. else
  166. getgenv().AimPart = getgenv().OldAimPart
  167.  
  168. end
  169. end
  170. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement