Advertisement
eruaaaaaaa

Untitled

Sep 18th, 2022
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.80 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. local f = GetChildrenWhichIsA(charac, "BasePart")
  491. for i,v in pairs(f) do
  492. if v == charac:FindFirstChild("Left Arm") or v == charac:FindFirstChild("Right Arm") or v == charac:FindFirstChild("Left Leg") or v == charac:FindFirstChild("Right Leg") then
  493. table.insert(cignore, v)
  494. end
  495. end
  496.  
  497. --if cignore then
  498. table.insert(cignore, lcharac)
  499. local mtarget = self:GetTargetFromViewportPoint(mpos, 5000, cignore)
  500. local bodyPart = (FindFirstChild(lcharac, "Head") or FindFirstChild(lcharac, "HumanoidRootPart"))
  501. local BlockingParts = self:GetBlockingPart(bodyPart and bodyPart.Position, target.Position, cignore)
  502. if silent and self.TriggerBot and lcharac and BlockingParts and BlockingParts:IsDescendantOf(charac) then
  503. if not holding then
  504. holding = true
  505. mouse1press()
  506.  
  507.  
  508. if self.AutoPeak.PointPosition and not peaking then
  509. local hum = lcharac and FindFirstChildOfClass(lcharac, "Humanoid")
  510.  
  511. if hum then
  512. peaking = true
  513.  
  514. Controls:Disable()
  515. MoveTo(hum, self.AutoPeak.PointPosition)
  516.  
  517. local moveconn
  518. moveconn = Connect(hum.MoveToFinished, function()
  519. moveconn:Disconnect()
  520. moveconn = nil
  521.  
  522. Controls:Enable()
  523. peaking = false
  524. end)
  525.  
  526. task.delay(8, function()
  527. if moveconn then
  528. moveconn:Disconnect()
  529. moveconn = nil
  530.  
  531. Controls:Enable()
  532. peaking = false
  533. end
  534. end)
  535. end
  536. end
  537. else
  538. if self.TriggerBotSemi and (tick() - self.LastTrigger) >= self.TriggerBotTimeBetweenClick and not self.TriggerPaused then
  539. self.TriggerPaused = true
  540. task.wait(self.TriggerBotTime / 1000)
  541. mouse1press()
  542. self.LastTrigger = tick()
  543. self.TriggerPaused = false
  544. end
  545. end
  546. elseif silent and self.TriggerBot and lcharac and (not BlockingParts or not BlockingParts:IsDescendantOf(charac)) then
  547. if holding then
  548. holding = false
  549. mouse1release()
  550. end
  551. end
  552.  
  553. if mtarget and IsDescendantOf(mtarget, charac) then
  554. mspoof = nil
  555. 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
  556. self.Targets[plrz] = true
  557. end
  558. elseif silent then
  559. mspoof = self:GetClosestEdgeFromViewportPoint(mpos, target)
  560. else
  561. mspoof = nil
  562. end
  563.  
  564. if self.Targets[plrz] then
  565. if self.Deadzone.Enabled then
  566. target = (self.TargetPart and FindFirstChild(charac, self.TargetPart)) or target
  567. local pos, onscreen = WorldToViewportPoint(camera, target.Position)
  568. if onscreen and not self.Disabled then
  569. local g = (Vector2.new(pos.X, pos.Y) - mpos) / Vector2.new(self.Deadzone.XSmoothingPercent * self.WidthFactor, self.Deadzone.YSmoothingPercent * self.WidthFactor)
  570. mousemoverel(g.X, g.Y)
  571. end
  572. end
  573. end
  574.  
  575. --local pos, onscreen = WorldToViewportPoint(camera, target.Position)
  576. local g = self.TargetPart and charac:FindFirstChild(self.TargetPart).Position or charac:FindFirstChild("HumanoidRootPart").Position
  577. if g then
  578.  
  579. local pos, onscreen = WorldToViewportPoint(camera, g)
  580. if onscreen and not self.Disabled then
  581. local mpos = self:GetMouseViewportPoint()
  582. local mtarget = self:GetTargetFromViewportPoint(mpos, 5000, cignore)
  583.  
  584. 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
  585. if self.Targets[plrz] then
  586. local displ = (Vector2.new(pos.X, pos.Y) - mpos)
  587. local smoothing = displ.Magnitude / 10 * Vector2.new(self.XSmoothingPercent * self.WidthFactor, self.YSmoothingPercent * self.WidthFactor)
  588. local rel = Vector2.new(displ.X, displ.Y) / smoothing
  589.  
  590. 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
  591. 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
  592.  
  593. relative = Vector2.new(rX, rY)
  594. else
  595. if self.FlickSettings.Flick then
  596. local displ = (Vector2.new(pos.X, pos.Y) - mpos)
  597. local smoothing = displ.Magnitude / 10 * Vector2.new(self.FlickSettings.FlickXSmoothingPercent * self.WidthFactor, self.FlickSettings.FlickYSmoothingPercent * self.WidthFactor)
  598. local rel = Vector2.new(displ.X, displ.Y) / smoothing
  599.  
  600. 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
  601. 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
  602.  
  603. relative = Vector2.new(rX, rY)
  604. end
  605. end
  606. end
  607. end
  608. end
  609. else
  610. if holding then
  611. holding = false
  612. mouse1release()
  613. end
  614.  
  615. mspoof = nil
  616. end
  617. else
  618. if holding then
  619. holding = false
  620. mouse1release()
  621. end
  622.  
  623. mspoof = nil
  624. end
  625. else
  626. if holding then
  627. holding = false
  628. mouse1release()
  629. end
  630.  
  631. mspoof = nil
  632. end
  633. end)
  634. end
  635.  
  636. self.InputConnection = Connect(UserInputService.InputBegan, function(key)
  637. if self.Enabled and self.AutoPeak.Enabled and key.UserInputType == Enum.UserInputType.MouseButton3 then
  638. local root = LocalPlayer.Character and FindFirstChild(LocalPlayer.Character, "HumanoidRootPart")
  639.  
  640. if root then
  641. self.AutoPeak.PointPosition = not self.AutoPeak.PointPosition and root.Position or nil
  642. end
  643. end
  644. end)
  645.  
  646. local Players2 = game.GetService(game, "Players");
  647. local Client2 = Players2.LocalPlayer;
  648. local Mouse2 = Client2.GetMouse(Client2);
  649.  
  650. local old; old = hookmetamethod(game, "__index", newcclosure(function(i,v)
  651. if string.lower(v) == "hit" then
  652. if old(i, "ClassName") == "Mouse" or old(i, "ClassName") == "PlayerMouse" then
  653. if not checkcaller() then
  654. if mspoof then
  655. return CFrame.new(mspoof)
  656. end
  657. end
  658. end
  659. end
  660. return old(i,v)
  661. end))
  662.  
  663. local old2; old2 = hookmetamethod(game, "__namecall", newcclosure(function(self2, ...)
  664. if getnamecallmethod() == "ViewportPointToRay" and not checkcaller() and mspoof then
  665. local args = {...}
  666. local pos = GetMouseLocation(UserInputService)
  667. if math.abs(args[1] - (pos.X + self.Offset.X)) <= 3 and math.abs(args[2] - (pos.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. else
  673. if math.abs(args[1] - (Mouse2.X + self.Offset.X)) <= 3 and math.abs(args[2] - (Mouse2.Y + self.Offset.Y)) <= 3 then
  674. local newPos = workspace.CurrentCamera.WorldToViewportPoint(workspace.CurrentCamera, mspoof)
  675. args[1] = newPos.X
  676. args[2] = newPos.Y
  677. return old2(self2, table.unpack(args))
  678. end
  679. end
  680. elseif getnamecallmethod() == "ScreenPointToRay" and not checkcaller() and mspoof then
  681. local args = {...}
  682. local pos = GetMouseLocation(UserInputService)
  683. if math.abs(args[1] - (pos.X + self.Offset.X)) <= 3 and math.abs(args[2] - (pos.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. else
  689. if math.abs(args[1] - (Mouse2.X + self.Offset.X)) <= 3 and math.abs(args[2] - (Mouse2.Y + self.Offset.Y)) <= 3 then
  690. local newPos = workspace.CurrentCamera.WorldToScreenPoint(workspace.CurrentCamera, mspoof)
  691. args[1] = newPos.X
  692. args[2] = newPos.Y
  693. return old2(self2, table.unpack(args))
  694. end
  695. end
  696. end
  697. return old2(self2, ...)
  698. end))
  699.  
  700. --[[
  701. local old2; old2 = hookmetamethod(game, "__namecall", function(self2, ...)
  702. local args = {...}
  703. if getnamecallmethod() == "ScreenPointToRay" or getnamecallmethod() == "ViewportPointToRay" and mspoof then
  704. local SecondPosition = game.GetService(game, "UserInputService").GetMouseLocation(game.GetService(game, "UserInputService"))
  705. if args[1] == Mouse2.X and args[2] == Mouse2.Y or args[1] == SecondPosition.X and args[2] == SecondPosition.Y then
  706. local newPos = workspace.CurrentCamera.WorldToScreenPoint(workspace.CurrentCamera, mspoof)
  707. args[1] = newPos.X
  708. args[2] = newPos.Y
  709. return old2(self2, table.unpack(args))
  710. end
  711. end
  712. return old2(self2, ...)
  713. end)
  714. --]]
  715. end
  716.  
  717. --//Completely kills aimbot, as opposed to enabled = false
  718. function Aimbot:Kill()
  719. self.Enabled = false
  720.  
  721. if self.RenderStep then
  722. Disconnect(self.RenderStep)
  723. self.RenderStep = nil
  724. end
  725.  
  726. if self.Heartbeat then
  727. Disconnect(self.Heartbeat)
  728. self.Heartbeat = nil
  729. end
  730.  
  731. if self.InputConnection then
  732. Disconnect(self.InputConnection)
  733. self.InputConnection = nil
  734. end
  735. end
  736.  
  737. --//Constructor
  738. function Aimbot.new(presets)
  739. presets = presets or {}
  740. UpdateTable(presets, Aimbot.DefaultSettings)
  741.  
  742. local WallCheckParams = RaycastParams.new()
  743. WallCheckParams.FilterType = Enum.RaycastFilterType.Blacklist
  744. WallCheckParams.IgnoreWater = presets.IgnoreWater
  745. WallCheckParams.FilterDescendantsInstances = presets.DefaultIgnore
  746.  
  747. presets.WallCheckParams = WallCheckParams
  748. return setmetatable(presets, Aimbot)
  749. end
  750.  
  751. --//Return with default settings
  752. return Aimbot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement