Advertisement
jamkles

jamkles camlock

Mar 12th, 2024 (edited)
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.79 KB | None | 0 0
  1. getgenv().keytoclick = "V"
  2. tool = Instance.new("Tool")
  3. tool.RequiresHandle = false
  4. tool.Name = keytoclick
  5. tool.Activated:connect(function()
  6. local vim = game:service("VirtualInputManager")
  7. vim:SendKeyEvent(true, keytoclick, false, game)
  8. end)
  9. tool.Parent = game.Players.LocalPlayer.Backpack
  10.  
  11. game.StarterGui:SetCore("SendNotification", {
  12. Title = "jamkles camlock";
  13. Text = "tool loaded";
  14.  
  15. })
  16.  
  17. local player = game.Players.LocalPlayer
  18.  
  19. local function connectCharacterAdded()
  20. player.CharacterAdded:Connect(onCharacterAdded)
  21. end
  22.  
  23. connectCharacterAdded()
  24.  
  25. player.CharacterRemoving:Connect(function()
  26. tool.Parent = game.Players.LocalPlayer.Backpack
  27. end)
  28.  
  29.  
  30.  
  31. getgenv().Prediction = 0.112
  32. getgenv().AimPart = "HumanoidRootPart"
  33. getgenv().Key = "V" or "dpadup"
  34. getgenv().DisableKey = "P"
  35.  
  36. getgenv().FOV = true
  37. getgenv().ShowFOV = false
  38. getgenv().FOVSize = 70
  39.  
  40.  
  41. local Players = game:GetService("Players")
  42. local RS = game:GetService("RunService")
  43. local WS = game:GetService("Workspace")
  44. local GS = game:GetService("GuiService")
  45. local SG = game:GetService("StarterGui")
  46.  
  47.  
  48. local LP = Players.LocalPlayer
  49. local Mouse = LP:GetMouse()
  50. local Camera = WS.CurrentCamera
  51. local GetGuiInset = GS.GetGuiInset
  52.  
  53. local AimlockState = true
  54. local Locked
  55. local Victim
  56.  
  57. local SelectedKey = getgenv().Key
  58. local SelectedDisableKey = getgenv().DisableKey
  59.  
  60.  
  61.  
  62. function Notify(tx)
  63. SG:SetCore("SendNotification", {
  64. Title = "jamkles.lua",
  65. Text = tx,
  66. Duration = 15
  67. })
  68. end
  69.  
  70. --// if loaded then
  71.  
  72. if getgenv().Loaded == true then
  73. Notify("Aimlock is already loaded")
  74. return
  75. end
  76.  
  77. getgenv().Loaded = true
  78.  
  79. --// fov
  80.  
  81. local fov = Drawing.new("Circle")
  82. fov.Filled = false
  83. fov.Transparency = 1
  84. fov.Thickness = 1
  85. fov.Color = Color3.fromRGB(255, 255, 0)
  86. fov.NumSides = 1000
  87.  
  88. --// fncs
  89.  
  90. function update()
  91. if getgenv().FOV == true then
  92. if fov then
  93. fov.Radius = getgenv().FOVSize * 2
  94. fov.Visible = getgenv().ShowFOV
  95. fov.Position = Vector2.new(Mouse.X, Mouse.Y + GetGuiInset(GS).Y)
  96.  
  97. return fov
  98. end
  99. end
  100. end
  101.  
  102. function WTVP(arg)
  103. return Camera:WorldToViewportPoint(arg)
  104. end
  105.  
  106. function WTSP(arg)
  107. return Camera.WorldToScreenPoint(Camera, arg)
  108. end
  109.  
  110. function getClosest()
  111. local closestPlayer
  112. local shortestDistance = math.huge
  113.  
  114. for i, v in pairs(game.Players:GetPlayers()) do
  115.  
  116. if v ~= game.Players.LocalPlayer and v.Character and v.Character:FindFirstChild("Humanoid") and v.Character.Humanoid.Health ~= 0 and v.Character:FindFirstChild(getgenv().AimPart) then
  117. local pos = Camera:WorldToViewportPoint(v.Character.PrimaryPart.Position)
  118. local magnitude = (Vector2.new(pos.X, pos.Y) - Vector2.new(Mouse.X, Mouse.Y)).magnitude
  119.  
  120. if (getgenv().FOV) then
  121. if (fov.Radius > magnitude and magnitude < shortestDistance) then
  122. closestPlayer = v
  123. shortestDistance = magnitude
  124. end
  125. else
  126. if (magnitude < shortestDistance) then
  127. closestPlayer = v
  128. shortestDistance = magnitude
  129. end
  130. end
  131. end
  132. end
  133. return closestPlayer
  134. end
  135.  
  136. --// suffer once again
  137.  
  138. Mouse.KeyDown:Connect(function(k)
  139. SelectedKey = SelectedKey:lower()
  140. SelectedDisableKey = SelectedDisableKey:lower()
  141. if k == SelectedKey then
  142. if AimlockState == true then
  143. Locked = not Locked
  144. if Locked then
  145. Victim = getClosest()
  146.  
  147. Notify("Locked onto: "..tostring(Victim.Character.Humanoid.DisplayName))
  148. else
  149. if Victim ~= nil then
  150. Victim = nil
  151.  
  152. Notify("Unlocked")
  153. end
  154. end
  155. else
  156. Notify("not enabled")
  157. end
  158. end
  159. if k == SelectedDisableKey then
  160. AimlockState = not AimlockState
  161. end
  162. end)
  163.  
  164. --// time to suffer again.......
  165.  
  166. RS.RenderStepped:Connect(function()
  167. update()
  168. if AimlockState == true then
  169. if Victim ~= nil then
  170. Camera.CFrame = CFrame.new(Camera.CFrame.p, Victim.Character[getgenv().AimPart].Position + Victim.Character[getgenv().AimPart].Velocity*getgenv().Prediction)
  171. end
  172. end
  173. end)
  174. while wait() do
  175. if getgenv().AutoPrediction == true then
  176. local pingvalue = game:GetService("Stats").Network.ServerStatsItem["Data Ping"]:GetValueString()
  177. local split = string.split(pingvalue,'(')
  178. local ping = tonumber(split[1])
  179. if ping < 225 then
  180. getgenv().Prediction = 1.4
  181. elseif ping < 215 then
  182. getgenv().Prediction = 1.2
  183. elseif ping < 205 then
  184. getgenv().Prediction = 1.0
  185. elseif ping < 190 then
  186. getgenv().Prediction = 0.10
  187. elseif ping < 180 then
  188. getgenv().Prediction = 0.12
  189. elseif ping < 170 then
  190. getgenv().Prediction = 0.15
  191. elseif ping < 160 then
  192. getgenv().Prediction = 0.18
  193. elseif ping < 150 then
  194. getgenv().Prediction = 0.110
  195. elseif ping < 140 then
  196. getgenv().Prediction = 0.113
  197. elseif ping < 130 then
  198. getgenv().Prediction = 0.116
  199. elseif ping < 120 then
  200. getgenv().Prediction = 0.120
  201. elseif ping < 110 then
  202. getgenv().Prediction = 0.124
  203. elseif ping < 105 then
  204. getgenv().Prediction = 0.127
  205. elseif ping < 90 then
  206. getgenv().Prediction = 0.130
  207. elseif ping < 80 then
  208. getgenv().Prediction = 0.155
  209. elseif ping < 70 then
  210. getgenv().Prediction = 0.155
  211. elseif ping < 60 then
  212. getgenv().Prediction = 0.155
  213. elseif ping < 50 then
  214. getgenv().Prediction = 0.155
  215. elseif ping < 40 then
  216. getgenv().Prediction = 0.155
  217. elseif ping < 30 then
  218. getgenv().Prediction = 0.155
  219. elseif ping < 20 then
  220. getgenv().Prediction = 0.155
  221. end
  222. end
  223. end
  224.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement