Advertisement
jamkles

pc cam

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