Advertisement
donte_scripts

blatant camlock

Jun 25th, 2023
1,835
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.54 KB | None | 0 0
  1. --sub to dhdemon on yt
  2.  
  3. getgenv().OldAimPart = "HumanoidRootPart"
  4. getgenv().AimPart = "UpperTorso" -- For R15 Games: {UpperTorso, LowerTorso, HumanoidRootPart, Head} | For R6 Games: {Head, Torso, HumanoidRootPart}
  5. getgenv().AimlockKey = "c" -- change to whatver u want make sure its lowercase
  6. getgenv().AimRadius = 500 -- How far away from someones character you want to lock on at
  7. getgenv().ThirdPerson = true
  8. getgenv().FirstPerson = true
  9. 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)
  10. 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
  11. getgenv().PredictionVelocity = 6.18
  12. getgenv().CheckIfJumped = true
  13. getgenv().Smoothness = false
  14. getgenv().SmoothnessAmount = 0.5
  15.  
  16. local Players, Uis, RService, SGui = game:GetService"Players", game:GetService"UserInputService", game:GetService"RunService", game:GetService"StarterGui";
  17. local Client, Mouse, Camera, CF, RNew, Vec3, Vec2 = Players.LocalPlayer, Players.LocalPlayer:GetMouse(), workspace.CurrentCamera, CFrame.new, Ray.new, Vector3.new, Vector2.new;
  18. local Aimlock, MousePressed, CanNotify = true, false, false;
  19. local AimlockTarget;
  20. local OldPre;
  21.  
  22.  
  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. -- Credits to whoever made this, i didnt make it, and my own mouse2plr function kinda sucks
  43. local players = {}
  44. local PLAYER_HOLD = {}
  45. local DISTANCES = {}
  46. for i, v in pairs(Players:GetPlayers()) do
  47. if v ~= Client then
  48. table.insert(players, v)
  49. end
  50. end
  51. for i, v in pairs(players) do
  52. if v.Character ~= nil then
  53. local AIM = v.Character:FindFirstChild("Head")
  54. if getgenv().TeamCheck == true and v.Team ~= Client.Team then
  55. local DISTANCE = (v.Character:FindFirstChild("Head").Position - game.Workspace.CurrentCamera.CFrame.p).magnitude
  56. local RAY = Ray.new(game.Workspace.CurrentCamera.CFrame.p, (Mouse.Hit.p - game.Workspace.CurrentCamera.CFrame.p).unit * DISTANCE)
  57. local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  58. local DIFF = math.floor((POS - AIM.Position).magnitude)
  59. PLAYER_HOLD[v.Name .. i] = {}
  60. PLAYER_HOLD[v.Name .. i].dist= DISTANCE
  61. PLAYER_HOLD[v.Name .. i].plr = v
  62. PLAYER_HOLD[v.Name .. i].diff = DIFF
  63. table.insert(DISTANCES, DIFF)
  64. elseif getgenv().TeamCheck == false and v.Team == Client.Team then
  65. local DISTANCE = (v.Character:FindFirstChild("Head").Position - game.Workspace.CurrentCamera.CFrame.p).magnitude
  66. local RAY = Ray.new(game.Workspace.CurrentCamera.CFrame.p, (Mouse.Hit.p - game.Workspace.CurrentCamera.CFrame.p).unit * DISTANCE)
  67. local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  68. local DIFF = math.floor((POS - AIM.Position).magnitude)
  69. PLAYER_HOLD[v.Name .. i] = {}
  70. PLAYER_HOLD[v.Name .. i].dist= DISTANCE
  71. PLAYER_HOLD[v.Name .. i].plr = v
  72. PLAYER_HOLD[v.Name .. i].diff = DIFF
  73. table.insert(DISTANCES, DIFF)
  74. end
  75. end
  76. end
  77.  
  78. if unpack(DISTANCES) == nil then
  79. return nil
  80. end
  81.  
  82. local L_DISTANCE = math.floor(math.min(unpack(DISTANCES)))
  83. if L_DISTANCE > getgenv().AimRadius then
  84. return nil
  85. end
  86.  
  87. for i, v in pairs(PLAYER_HOLD) do
  88. if v.diff == L_DISTANCE then
  89. return v.plr
  90. end
  91. end
  92. return nil
  93. end
  94.  
  95. Mouse.KeyDown:Connect(function(a)
  96. if not (Uis:GetFocusedTextBox()) then
  97. if a == AimlockKey and AimlockTarget == nil then
  98. pcall(function()
  99. if MousePressed ~= true then MousePressed = true end
  100. local Target;Target = GetNearestTarget()
  101. if Target ~= nil then
  102. AimlockTarget = Target
  103. end
  104. end)
  105. elseif a == AimlockKey and AimlockTarget ~= nil then
  106. if AimlockTarget ~= nil then AimlockTarget = nil end
  107. if MousePressed ~= false then
  108. MousePressed = false
  109. end
  110. end
  111. end
  112. end)
  113.  
  114. RService.RenderStepped:Connect(function()
  115. if getgenv().ThirdPerson == true and getgenv().FirstPerson == true then
  116. if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude > 1 or (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 then
  117. CanNotify = true
  118. else
  119. CanNotify = false
  120. end
  121. elseif getgenv().ThirdPerson == true and getgenv().FirstPerson == false then
  122. if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude > 1 then
  123. CanNotify = true
  124. else
  125. CanNotify = false
  126. end
  127. elseif getgenv().ThirdPerson == false and getgenv().FirstPerson == true then
  128. if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 then
  129. CanNotify = true
  130. else
  131. CanNotify = false
  132. end
  133. end
  134. if Aimlock == true and MousePressed == true then
  135. if AimlockTarget and AimlockTarget.Character and AimlockTarget.Character:FindFirstChild(getgenv().AimPart) then
  136. if getgenv().FirstPerson == true then
  137. if CanNotify == true then
  138. if getgenv().PredictMovement == true then
  139. if getgenv().Smoothness == true then
  140. --// The part we're going to lerp/smoothen \\--
  141. local Main = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position + AimlockTarget.Character[getgenv().AimPart].Velocity/PredictionVelocity)
  142.  
  143. --// Making it work \\--
  144. Camera.CFrame = Camera.CFrame:Lerp(Main, getgenv().SmoothnessAmount, Enum.EasingStyle.Elastic, Enum.EasingDirection.InOut)
  145. else
  146. Camera.CFrame = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position + AimlockTarget.Character[getgenv().AimPart].Velocity/PredictionVelocity)
  147. end
  148. elseif getgenv().PredictMovement == false then
  149. if getgenv().Smoothness == true then
  150. --// The part we're going to lerp/smoothen \\--
  151. local Main = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position)
  152.  
  153. --// Making it work \\--
  154. Camera.CFrame = Camera.CFrame:Lerp(Main, getgenv().SmoothnessAmount, Enum.EasingStyle.Elastic, Enum.EasingDirection.InOut)
  155. else
  156. Camera.CFrame = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position)
  157. end
  158. end
  159. end
  160. end
  161. end
  162. end
  163. if CheckIfJumped == true then
  164. if AimlockTarget.Character.HuDDDDDDDDDDWmanoid.FloorMaterial == Enum.Material.Air then
  165.  
  166. getgenv().AimPart = "UpperTorso"
  167. else
  168. getgenv().AimPart = getgenv().OldAimPart
  169.  
  170. end
  171. end
  172. end)
  173.  
  174. --by 23 asmo unleak
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement