Advertisement
eruaaaaaaa

Untitled

Sep 17th, 2022 (edited)
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.43 KB | None | 0 0
  1. local Aimbot = {}
  2. Aimbot.__index = Aimbot
  3.  
  4. --//Localization
  5. local Instance = Instance
  6. local game = game
  7. local math = math
  8. local setmetatable = setmetatable
  9. local workspace = workspace
  10. local CFrame = CFrame
  11. local Vector3 = Vector3
  12. local Vector2 = Vector2
  13. local Random = Random
  14. local RaycastParams = RaycastParams
  15. local pairs = pairs
  16. local task = task
  17. local string = string
  18. local table = table
  19. local require = require
  20. local Enum = Enum
  21. local getrawmetatable = getrawmetatable
  22. local replaceclosure = replaceclosure
  23. local setreadonly = setreadonly
  24. local checkcaller = checkcaller
  25. local getclock = os.clock
  26. local mouse1press = mouse1press
  27. local mouse1release = mouse1release
  28. local mousemoverel = mousemoverel
  29. local hookfunction = hookfunction
  30. local newcclosure = newcclosure
  31.  
  32. --//Instance methods
  33. local Raycast = workspace.Raycast
  34. local GetPropertyChangedSignal = game.GetPropertyChangedSignal
  35. local Connect = game.ChildAdded.Connect
  36. local Destroy = game.Destroy
  37. local GetService = game.GetService
  38. local FindFirstChildOfClass = game.FindFirstChildOfClass
  39. local FindFirstChild = game.FindFirstChild
  40. local WaitForChild = game.WaitForChild
  41. local GetChildren = game.GetChildren
  42. local GetDescendants = game.GetDescendants
  43. local IsA = game.IsA
  44. local IsDescendantOf = game.IsDescendantOf
  45.  
  46. --//Services
  47. local Players = GetService(game, "Players")
  48. local UserInputService = GetService(game, "UserInputService")
  49. local RunService = GetService(game, "RunService")
  50. local GuiService = GetService(game, "GuiService")
  51.  
  52. --//Temporary instances
  53. local tempcam = Instance.new("Camera")
  54. local temphum = Instance.new("Humanoid")
  55. local tempconn = Connect(game.AncestryChanged, function() end)
  56.  
  57. --//Other instance methods
  58. local WorldToViewportPoint = tempcam.WorldToViewportPoint
  59. local WorldToScreenPoint = tempcam.WorldToScreenPoint
  60. local GetPlayers = Players.GetPlayers
  61. local GetMouseLocation = UserInputService.GetMouseLocation
  62. local ViewportPointToRay = tempcam.ViewportPointToRay
  63. local Disconnect = tempconn.Disconnect
  64. local MoveTo = temphum.MoveTo
  65. local Lerp2D = Vector2.new().Lerp
  66.  
  67. --//Cleanup
  68. Destroy(temphum)
  69. Destroy(tempcam)
  70. Disconnect(tempconn)
  71.  
  72. --//Local functions and constant variables
  73. Aimbot.DefaultSettings = {
  74. RadiusPercentAt1 = 130, --//Radius percent of screen width at 1 stud for aimbot
  75. XSmoothingPercent = .125,
  76. YSmoothingPercent = .15, --//Slows down mouse movement by a percentage of screen width
  77. DistanceBias = 1, --//Raises sensitivity of distance from camera when choosing target
  78. Offset = Vector2.new(0, 0), --//Mouse offset in pixels
  79. SilentRadiusPercentAt1 = 130, --//Radius percent of screen width at 1 stud for silent aim
  80. IgnoreTransparent = true, --//Whether to ignore transparent parts above the threshold or not in wallcheck
  81. IgnoreWater = false, --//Whether to ignore water in wallcheck
  82. TransparencyThreshold = .5, --//Threshold for what transparency or greater counts as ignorable
  83. DefaultIgnore = {}, --//List for what the aimbot should ignore during wallcheck
  84. IsAliveCheck = true, --//Ignore dead players
  85. TeamCheck = true,
  86. TriggerBot = true,
  87. InvisibleCheck = true,
  88. TriggerBotTime = 160,
  89. TriggerBotSemi = false,
  90. TriggerBotTimeBetweenClick = .3,
  91. HoldControl = false,
  92. Holding = false,
  93. SizeCheck = false,
  94. FlickSettings = {
  95. FlickXSmoothingPercent = .9, -- .6
  96. FlickYSmoothingPercent = .9, -- .6
  97. Flick = true -- false if only will track
  98. },
  99. AutoPeak = {
  100. Enabled = false,
  101. PointPosition = nil -- dont chage this
  102. },
  103. RadiusCap = nil
  104. }
  105.  
  106.  
  107. --Test
  108. local LocalPlayer = Players.LocalPlayer
  109. local Mouse = LocalPlayer.GetMouse(LocalPlayer)
  110. local GuiInset = GuiService.GetGuiInset(GuiService)
  111. local GameMeta = getrawmetatable(game)
  112.  
  113. local function OnCameraChange()
  114. local cam = workspace.CurrentCamera
  115.  
  116. Aimbot.Camera = cam
  117. Aimbot.ViewportSize = cam.ViewportSize
  118. Aimbot.WidthFactor = cam.ViewportSize.X / 100
  119. end
  120.  
  121. local function UpdateTable(tab, update)
  122. for name, value in pairs(update) do
  123. if tab[name] == nil then
  124. tab[name] = value
  125. end
  126. end
  127. end
  128.  
  129. local function GetChildrenWhichIsA(part, baseclass)
  130. local parts = GetChildren(part)
  131. local len = #parts
  132.  
  133. local filtered = {}
  134.  
  135. if len > 0 then
  136. for i = 1, len do
  137. local p = parts[i]
  138.  
  139. if IsA(p, baseclass) then
  140. table.insert(filtered, p)
  141. end
  142. end
  143. end
  144.  
  145. return filtered
  146. end
  147.  
  148. local function GetDescendantsWhichIsA(part, baseclass)
  149. local parts = GetDescendants(part)
  150. local len = #parts
  151.  
  152. local filtered = {}
  153.  
  154. if len > 0 then
  155. for i = 1, len do
  156. local p = parts[i]
  157.  
  158. if IsA(p, baseclass) then
  159. table.insert(filtered, p)
  160. end
  161. end
  162. end
  163.  
  164. return filtered
  165. end
  166.  
  167.  
  168. local function GetChildrenWhichIsNotA(part, baseclass)
  169. local parts = GetChildren(part)
  170. local len = #parts
  171.  
  172. local filtered = {}
  173.  
  174. if len > 0 then
  175. for i = 1, len do
  176. local p = parts[i]
  177.  
  178. if not IsA(p, baseclass) then
  179. table.insert(filtered, p)
  180. end
  181. end
  182. end
  183.  
  184. return filtered
  185. end
  186.  
  187. if workspace.CurrentCamera then
  188. OnCameraChange()
  189. end
  190.  
  191. Connect(GetPropertyChangedSignal(workspace, "CurrentCamera"), OnCameraChange)
  192.  
  193. --//Methods
  194.  
  195. --//Gets bias value at a given distance
  196. function Aimbot:GetBiasAtDistance(distance)
  197. if self.Camera then
  198. return distance * self.DistanceBias * self.WidthFactor
  199. end
  200. end
  201.  
  202. --//Gets circle radius at a given distance
  203. function Aimbot:GetRadiusAtDistance(rpercent, distance)
  204. if self.Camera then
  205. if self.RadiusCap then
  206. if distance >= self.RadiusCap and rpercent ~= self.SilentRadiusPercentAt1 and rpercent == self.RadiusPercentAt1 then
  207. distance = self.RadiusCap
  208. elseif self.FlickSettings.RadiusCap and rpercent == self.FlickSettings.RadiusPercentAt1 and distance >= self.FlickSettings.RadiusCap then
  209. distance = self.FlickSettings.RadiusCap
  210. end
  211. end
  212.  
  213. return rpercent / distance * self.WidthFactor
  214. end
  215. end
  216.  
  217. --//Checks for parts obscuring camera, including terrain - unlike Camera:GetPartsObscuringTarget
  218. function Aimbot:GetBlockingPart(origin, position, ignore)
  219. self.WallCheckParams.FilterDescendantsInstances = self.DefaultIgnore --//Incase it got updated
  220.  
  221. local dir = position - origin
  222. local thisignore = self.WallCheckParams.FilterDescendantsInstances --//Copies table for you essentially
  223.  
  224. if ignore then
  225. table.move(ignore, 1, #ignore, #thisignore + 1, thisignore)
  226. end
  227.  
  228. while true do
  229. self.WallCheckParams.FilterDescendantsInstances = thisignore --//Copies
  230. local result = Raycast(workspace, origin, dir, self.WallCheckParams)
  231.  
  232. if result then
  233. if self.IgnoreTransparent and result.Instance.ClassName ~= "Terrain" and result.Instance.Transparency >= self.TransparencyThreshold then
  234. table.insert(thisignore, result.Instance)
  235. continue
  236. end
  237.  
  238. self.WallCheckParams.FilterDescendantsInstances = self.DefaultIgnore
  239. return result.Instance
  240. end
  241.  
  242. self.WallCheckParams.FilterDescendantsInstances = self.DefaultIgnore
  243. return nil
  244. end
  245. end
  246.  
  247. --//Gets target from viewport point
  248. function Aimbot:GetTargetFromViewportPoint(point, distance, ignore)
  249. local camera = self.Camera
  250.  
  251. if camera then
  252. local ray = ViewportPointToRay(camera, point.X, point.Y)
  253. return self:GetBlockingPart(ray.Origin, ray.Origin + ray.Direction * distance, ignore)
  254. end
  255. end
  256.  
  257. --//Gets closest edge on part from viewport point
  258. function Aimbot:GetClosestEdgeFromViewportPoint(point, part)
  259. local camera = self.Camera
  260.  
  261. if camera then
  262. local Blacklisted = {
  263. ["Right Arm"] = "LeftSurface",
  264. ["Left Arm"] = "RightSurface",
  265. ["Right Leg"] = "TopSurface",
  266. ["Left Leg"] = "TopSurface",
  267. ["Head"] = "BottomSurface"
  268. }
  269.  
  270. local ray = ViewportPointToRay(camera, point.X, point.Y)
  271. local ppos = part.Position
  272.  
  273. local dist = (ray.Origin - ppos).Magnitude
  274. local dir = (ray.Origin + ray.Direction * dist - ppos).Unit
  275.  
  276. local size = part.Size
  277.  
  278. local half = size / 2
  279. local final = dir * size
  280.  
  281. local Pos = ppos + Vector3.new(
  282. final.X < 0 and math.max(final.X, -half.X + size.X / 10) or math.min(final.X, half.X - size.X / 10),
  283. final.Y < 0 and math.max(final.Y, -half.Y + size.Y / 10) or math.min(final.Y, half.Y - size.Y / 10),
  284. final.Z < 0 and math.max(final.Z, -half.Z + size.Z / 10) or math.min(final.Z, half.Z - size.Z / 10)
  285. )
  286.  
  287. local g = {
  288. TopSurface = part.CFrame * CFrame.new(0, part.Size.Y / 2, 0) * CFrame.Angles(math.pi / 2, 0, 0),
  289. BottomSurface = part.CFrame * CFrame.new(0, part.Size.Y / -2, 0) * CFrame.Angles(math.pi / -2, 0, 0),
  290. FrontSurface = part.CFrame * CFrame.new(0, 0, part.Size.Z / -2),
  291. BackSurface = part.CFrame * CFrame.new(0, 0, part.Size.Z / 2) * CFrame.Angles(0, math.pi, 0),
  292. LeftSurface = part.CFrame * CFrame.new(part.Size.X / -2, 0, 0) * CFrame.Angles(0, math.pi / 2, 0),
  293. RightSurface = part.CFrame * CFrame.new(part.Size.X / 2, 0, 0) * CFrame.Angles(0, math.pi / -2, 0)
  294. }
  295.  
  296. local closest = math.huge
  297. local new = nil
  298. for i,v in pairs(g) do
  299. local h = (Pos - v.Position).Magnitude
  300. if h < closest then
  301. new = i
  302. closest = h
  303. end
  304. end
  305.  
  306. if Blacklisted[part.Name] ~= new then
  307. return Pos
  308. end
  309. end
  310. end
  311.  
  312. --//Gets mouse location with offset accounted for
  313. function Aimbot:GetMouseViewportPoint()
  314. return GetMouseLocation(UserInputService) + self.Offset
  315. end
  316.  
  317. --//Gets best target from a list of parts and a viewport point, ignoreparent specifies whether to filter the entire parent
  318. function Aimbot:GetBestPartFromViewportPoint(position, parts, ignoreparent, ignore)
  319. local camera = self.Camera
  320.  
  321. if camera then
  322. local len = #parts
  323.  
  324. if len > 0 then
  325. local leastbias, leastwdist, leastpdist, part = math.huge, math.huge, math.huge, nil
  326. local campos = camera.CFrame.Position
  327.  
  328. ignore = ignore or {}
  329. local ipos = #ignore + 1
  330.  
  331. for i = 1, len do
  332. local cpart = parts[i]
  333. local cpos = cpart.Position
  334.  
  335. local point, onscreen = WorldToViewportPoint(camera, cpos)
  336. ignore[ipos] = ignoreparent and cpart.Parent or cpart
  337.  
  338. if onscreen and not self:GetBlockingPart(campos, cpos, ignore) then
  339. local pdist = (position - Vector2.new(point.X, point.Y)).Magnitude --//Pixel Distance
  340. local wdist = (campos - cpos).Magnitude --//World Distance
  341. local playerOb = cpart.Parent:FindFirstChildOfClass("Humanoid") and game:GetService("Players"):GetPlayerFromCharacter(cpart.Parent) or cpart.Parent.Parent:FindFirstChildOfClass("Humanoid") and game:GetService("Players"):GetPlayerFromCharacter(cpart.Parent.Parent)
  342.  
  343.  
  344. if pdist <= self:GetRadiusAtDistance(self.Targets[playerOb] and self.RadiusPercentAt1 or self.FlickSettings.RadiusPercentAt1, wdist) then
  345. local bias = self:GetBiasAtDistance(wdist) + pdist
  346.  
  347. if bias < leastbias or (bias == leastbias and wdist < leastwdist) then
  348. leastbias = bias
  349. leastwdist = wdist
  350. leastpdist = pdist
  351. part = cpart
  352. end
  353. end
  354. end
  355. end
  356.  
  357. ignore[ipos] = nil
  358. return part, part and leastpdist <= self:GetRadiusAtDistance(self.SilentRadiusPercentAt1, leastwdist)
  359. end
  360. end
  361. end
  362.  
  363. --//Gets best player to target based on a viewport point
  364. function Aimbot:GetBestPlayerTargetFromViewportPoint(pos)
  365. if self.Camera then
  366. local plrs = GetPlayers(Players)
  367. local len = #plrs
  368.  
  369. if len > 0 then
  370. local parts = {}
  371. local lparts = 1
  372. local maxPlr = {}
  373. for i = 1, len do
  374. local plr = plrs[i]
  375. local charac = plr.Character
  376.  
  377. if plr ~= LocalPlayer and charac then
  378. if self.TeamCheck and not plr.Neutral and plr.Team == LocalPlayer.Team then
  379. continue
  380. end
  381.  
  382. if self.IsAliveCheck then
  383. local hum = FindFirstChildOfClass(charac, "Humanoid")
  384.  
  385. if not hum or hum.Health <= 0 then
  386. continue
  387. end
  388. end
  389.  
  390. if self.InvisibleCheck then
  391. local head = FindFirstChild(charac, "Head")
  392.  
  393. if not head or head.Transparency >= 1 then
  394. continue
  395. end
  396. end
  397.  
  398. if self.SizeCheck then
  399. local hum = FindFirstChild(charac, "HumanoidRootPart")
  400.  
  401. if not hum or hum.Size.X < 2 or hum.Size.Y < 2 or hum.Size.Z < 1 then
  402. continue
  403. end
  404. end
  405.  
  406. if self.AntiLag then
  407. if #maxPlr >= 4 then continue end
  408. table.insert(maxPlr, plr)
  409. end
  410.  
  411. local filtered = GetChildrenWhichIsA(charac, "BasePart")
  412. local lfiltered = #filtered
  413.  
  414. table.move(filtered, 1, lfiltered, lparts, parts)
  415. lparts = lparts + lfiltered
  416. end
  417. end
  418. local target, silent = self:GetBestPartFromViewportPoint(pos, parts, true)
  419. local plrz = target and game:GetService("Players"):GetPlayerFromCharacter(target.Parent) or "nil"
  420. for aa, _ in pairs(self.Targets) do
  421. if aa ~= plrz then self.Targets[aa] = false end
  422. end
  423. if target then
  424. return target, silent
  425. end
  426. end
  427. end
  428. end
  429.  
  430. --//Begins aimbot
  431.  
  432. function Aimbot:Start()
  433. self.Enabled = true
  434. self.LastTrigger = 0
  435. self.TriggerPaused = false
  436. self.Targets = {}; setmetatable(self.Targets, {__index = function(s, k)
  437. s[k] = false
  438. return false
  439. end})
  440.  
  441. local relative
  442. local holding = false
  443. local mspoof
  444.  
  445. local peaking = false
  446. local lastframe = getclock()
  447.  
  448. if not self.RenderStep then
  449. local sum = 0
  450.  
  451. self.RenderStep = Connect(RunService.RenderStepped, function(delta)
  452. sum = sum + delta
  453.  
  454. if sum >= 1 / 60 then
  455. if self.Enabled and relative then
  456. if self.HoldControl and self.Holding or not self.HoldControl then
  457. mousemoverel(relative.X, relative.Y)
  458. relative = nil
  459. end
  460. end
  461.  
  462. sum = sum - 1 / 60
  463. end
  464. end)
  465. end
  466.  
  467. if not self.Heartbeat then
  468. local sum = 0
  469. self.Heartbeat = Connect(RunService.Heartbeat, function(delta)
  470.  
  471. if self.Enabled then
  472. local camera = self.Camera
  473.  
  474. if camera then
  475. local mpos = self:GetMouseViewportPoint()
  476. local target, silent = self:GetBestPlayerTargetFromViewportPoint(mpos)
  477.  
  478. if not target then
  479. if holding then
  480. holding = false
  481. mouse1release()
  482. end
  483. end
  484.  
  485. if target then
  486. local charac = target.Parent
  487. local plrz = game:GetService("Players"):GetPlayerFromCharacter(charac)
  488. local lcharac = LocalPlayer.Character
  489. local cignore = GetChildrenWhichIsNotA(charac, "BasePart")
  490.  
  491. --if cignore then
  492. table.insert(cignore, lcharac)
  493. local mtarget = self:GetTargetFromViewportPoint(mpos, 5000, cignore)
  494. local bodyPart = (FindFirstChild(lcharac, "Head") or FindFirstChild(lcharac, "HumanoidRootPart"))
  495. local BlockingParts = self:GetBlockingPart(bodyPart and bodyPart.Position, target.Position, cignore)
  496. if silent and self.TriggerBot and lcharac and BlockingParts and BlockingParts:IsDescendantOf(charac) then
  497. if not holding then
  498. holding = true
  499. mouse1press()
  500.  
  501.  
  502. if self.AutoPeak.PointPosition and not peaking then
  503. local hum = lcharac and FindFirstChildOfClass(lcharac, "Humanoid")
  504.  
  505. if hum then
  506. peaking = true
  507.  
  508. Controls:Disable()
  509. MoveTo(hum, self.AutoPeak.PointPosition)
  510.  
  511. local moveconn
  512. moveconn = Connect(hum.MoveToFinished, function()
  513. moveconn:Disconnect()
  514. moveconn = nil
  515.  
  516. Controls:Enable()
  517. peaking = false
  518. end)
  519.  
  520. task.delay(8, function()
  521. if moveconn then
  522. moveconn:Disconnect()
  523. moveconn = nil
  524.  
  525. Controls:Enable()
  526. peaking = false
  527. end
  528. end)
  529. end
  530. end
  531. else
  532. if self.TriggerBotSemi and (tick() - self.LastTrigger) >= self.TriggerBotTimeBetweenClick and not self.TriggerPaused then
  533. self.TriggerPaused = true
  534. task.wait(self.TriggerBotTime / 1000)
  535. mouse1press()
  536. self.LastTrigger = tick()
  537. self.TriggerPaused = false
  538. end
  539. end
  540. elseif silent and self.TriggerBot and lcharac and (not BlockingParts or not BlockingParts:IsDescendantOf(charac)) then
  541. if holding then
  542. holding = false
  543. mouse1release()
  544. end
  545. end
  546.  
  547. if mtarget and IsDescendantOf(mtarget, charac) then
  548. mspoof = nil
  549. if not (mtarget == charac:FindFirstChild("Left Arm") or mtarget == charac:FindFirstChild("Right Arm") or mtarget == charac:FindFirstChild("Left Leg") or mtarget == charac:FindFirstChild("Right Leg")) then
  550. self.Targets[plrz] = true
  551. end
  552. elseif silent then
  553. mspoof = self:GetClosestEdgeFromViewportPoint(mpos, target)
  554. else
  555. mspoof = nil
  556. end
  557.  
  558. if self.Targets[plrz] then
  559. if self.Deadzone.Enabled then
  560. target = (self.TargetPart and FindFirstChild(charac, self.TargetPart)) or target
  561. local pos, onscreen = WorldToViewportPoint(camera, target.Position)
  562. if onscreen and not self.Disabled then
  563. local g = (Vector2.new(pos.X, pos.Y) - mpos) / Vector2.new(self.Deadzone.XSmoothingPercent * self.WidthFactor, self.Deadzone.YSmoothingPercent * self.WidthFactor)
  564. mousemoverel(g.X, g.Y)
  565. end
  566. end
  567. end
  568.  
  569. --local pos, onscreen = WorldToViewportPoint(camera, target.Position)
  570. local g = self.TargetPart and charac:FindFirstChild(self.TargetPart).Position or charac:FindFirstChild("HumanoidRootPart").Position
  571. if g then
  572.  
  573. local pos, onscreen = WorldToViewportPoint(camera, g)
  574. if onscreen and not self.Disabled then
  575. local mpos = self:GetMouseViewportPoint()
  576. local mtarget = self:GetTargetFromViewportPoint(mpos, 5000, cignore)
  577.  
  578. if not mtarget or IsDescendantOf(mtarget, charac) and (mtarget == charac:FindFirstChild("Left Arm") or mtarget == charac:FindFirstChild("Right Arm") or mtarget == charac:FindFirstChild("Left Leg") or mtarget == charac:FindFirstChild("Right Leg")) or not IsDescendantOf(mtarget, charac) then
  579. if self.Targets[plrz] then
  580. local displ = (Vector2.new(pos.X, pos.Y) - mpos)
  581. local smoothing = Vector2.new(self.XSmoothingPercent * self.WidthFactor, self.YSmoothingPercent * self.WidthFactor)
  582. local rel = Vector2.new(displ.X, displ.Y) / smoothing
  583.  
  584. local rX = (rel.X < 1 and rel.X > 0.001) and 1 or (rel.X < -0.001 and rel.X > -1) and -1 or rel.X
  585. local rY = (rel.Y < 1 and rel.Y > 0.001) and 1 or (rel.Y < -0.001 and rel.Y > -1) and -1 or rel.Y
  586.  
  587. relative = Vector2.new(rX, rY)
  588. else
  589. if self.FlickSettings.Flick then
  590. local displ = (Vector2.new(pos.X, pos.Y) - mpos)
  591. local smoothing = Vector2.new(self.FlickSettings.FlickXSmoothingPercent * self.WidthFactor, self.FlickSettings.FlickYSmoothingPercent * self.WidthFactor)
  592. local rel = Vector2.new(displ.X, displ.Y) / smoothing
  593.  
  594. local rX = (rel.X < 1 and rel.X > 0.001) and 1 or (rel.X < -0.001 and rel.X > -1) and -1 or rel.X
  595. local rY = (rel.Y < 1 and rel.Y > 0.001) and 1 or (rel.Y < -0.001 and rel.Y > -1) and -1 or rel.Y
  596.  
  597. relative = Vector2.new(rX, rY)
  598. end
  599. end
  600. end
  601. end
  602. end
  603. else
  604. if holding then
  605. holding = false
  606. mouse1release()
  607. end
  608.  
  609. mspoof = nil
  610. end
  611. else
  612. if holding then
  613. holding = false
  614. mouse1release()
  615. end
  616.  
  617. mspoof = nil
  618. end
  619. else
  620. if holding then
  621. holding = false
  622. mouse1release()
  623. end
  624.  
  625. mspoof = nil
  626. end
  627. end)
  628. end
  629.  
  630. self.InputConnection = Connect(UserInputService.InputBegan, function(key)
  631. if self.Enabled and self.AutoPeak.Enabled and key.UserInputType == Enum.UserInputType.MouseButton3 then
  632. local root = LocalPlayer.Character and FindFirstChild(LocalPlayer.Character, "HumanoidRootPart")
  633.  
  634. if root then
  635. self.AutoPeak.PointPosition = not self.AutoPeak.PointPosition and root.Position or nil
  636. end
  637. end
  638. end)
  639.  
  640. local Players2 = game.GetService(game, "Players");
  641. local Client2 = Players2.LocalPlayer;
  642. local Mouse2 = Client2.GetMouse(Client2);
  643.  
  644. local old; old = hookmetamethod(game, "__index", newcclosure(function(i,v)
  645. if string.lower(v) == "hit" then
  646. if old(i, "ClassName") == "Mouse" or old(i, "ClassName") == "PlayerMouse" then
  647. if not checkcaller() then
  648. if mspoof then
  649. return CFrame.new(mspoof)
  650. end
  651. end
  652. end
  653. end
  654. return old(i,v)
  655. end))
  656.  
  657. local old2; old2 = hookmetamethod(game, "__namecall", newcclosure(function(self2, ...)
  658. if getnamecallmethod() == "ViewportPointToRay" and not checkcaller() and mspoof then
  659. local args = {...}
  660. local pos = GetMouseLocation(UserInputService)
  661. if math.abs(args[1] - (pos.X + self.Offset.X)) <= 3 and math.abs(args[2] - (pos.Y + self.Offset.Y)) <= 3 then
  662. local newPos = workspace.CurrentCamera.WorldToViewportPoint(workspace.CurrentCamera, mspoof)
  663. args[1] = newPos.X
  664. args[2] = newPos.Y
  665. return old2(self2, table.unpack(args))
  666. else
  667. if math.abs(args[1] - (Mouse2.X + self.Offset.X)) <= 3 and math.abs(args[2] - (Mouse2.Y + self.Offset.Y)) <= 3 then
  668. local newPos = workspace.CurrentCamera.WorldToViewportPoint(workspace.CurrentCamera, mspoof)
  669. args[1] = newPos.X
  670. args[2] = newPos.Y
  671. return old2(self2, table.unpack(args))
  672. end
  673. end
  674. elseif getnamecallmethod() == "ScreenPointToRay" and not checkcaller() and mspoof then
  675. local args = {...}
  676. local pos = GetMouseLocation(UserInputService)
  677. if math.abs(args[1] - (pos.X + self.Offset.X)) <= 3 and math.abs(args[2] - (pos.Y + self.Offset.Y)) <= 3 then
  678. local newPos = workspace.CurrentCamera.WorldToScreenPoint(workspace.CurrentCamera, mspoof)
  679. args[1] = newPos.X
  680. args[2] = newPos.Y
  681. return old2(self2, table.unpack(args))
  682. else
  683. if math.abs(args[1] - (Mouse2.X + self.Offset.X)) <= 3 and math.abs(args[2] - (Mouse2.Y + self.Offset.Y)) <= 3 then
  684. local newPos = workspace.CurrentCamera.WorldToScreenPoint(workspace.CurrentCamera, mspoof)
  685. args[1] = newPos.X
  686. args[2] = newPos.Y
  687. return old2(self2, table.unpack(args))
  688. end
  689. end
  690. end
  691. return old2(self2, ...)
  692. end))
  693.  
  694. --[[
  695. local old2; old2 = hookmetamethod(game, "__namecall", function(self2, ...)
  696. local args = {...}
  697. if getnamecallmethod() == "ScreenPointToRay" or getnamecallmethod() == "ViewportPointToRay" and mspoof then
  698. local SecondPosition = game.GetService(game, "UserInputService").GetMouseLocation(game.GetService(game, "UserInputService"))
  699. if args[1] == Mouse2.X and args[2] == Mouse2.Y or args[1] == SecondPosition.X and args[2] == SecondPosition.Y then
  700. local newPos = workspace.CurrentCamera.WorldToScreenPoint(workspace.CurrentCamera, mspoof)
  701. args[1] = newPos.X
  702. args[2] = newPos.Y
  703. return old2(self2, table.unpack(args))
  704. end
  705. end
  706. return old2(self2, ...)
  707. end)
  708. --]]
  709. end
  710.  
  711. --//Completely kills aimbot, as opposed to enabled = false
  712. function Aimbot:Kill()
  713. self.Enabled = false
  714.  
  715. if self.RenderStep then
  716. Disconnect(self.RenderStep)
  717. self.RenderStep = nil
  718. end
  719.  
  720. if self.Heartbeat then
  721. Disconnect(self.Heartbeat)
  722. self.Heartbeat = nil
  723. end
  724.  
  725. if self.InputConnection then
  726. Disconnect(self.InputConnection)
  727. self.InputConnection = nil
  728. end
  729. end
  730.  
  731. --//Constructor
  732. function Aimbot.new(presets)
  733. presets = presets or {}
  734. UpdateTable(presets, Aimbot.DefaultSettings)
  735.  
  736. local WallCheckParams = RaycastParams.new()
  737. WallCheckParams.FilterType = Enum.RaycastFilterType.Blacklist
  738. WallCheckParams.IgnoreWater = presets.IgnoreWater
  739. WallCheckParams.FilterDescendantsInstances = presets.DefaultIgnore
  740.  
  741. presets.WallCheckParams = WallCheckParams
  742. return setmetatable(presets, Aimbot)
  743. end
  744.  
  745. --//Return with default settings
  746. return Aimbot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement