Advertisement
Prokri43

Evans camlock

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