Advertisement
eruaaaaaaa

Untitled

Sep 7th, 2022 (edited)
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.33 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. end
  209. end
  210.  
  211. return rpercent / distance * self.WidthFactor
  212. end
  213. end
  214.  
  215. --//Checks for parts obscuring camera, including terrain - unlike Camera:GetPartsObscuringTarget
  216. function Aimbot:GetBlockingPart(origin, position, ignore)
  217. self.WallCheckParams.FilterDescendantsInstances = self.DefaultIgnore --//Incase it got updated
  218.  
  219. local dir = position - origin
  220. local thisignore = self.WallCheckParams.FilterDescendantsInstances --//Copies table for you essentially
  221.  
  222. if ignore then
  223. table.move(ignore, 1, #ignore, #thisignore + 1, thisignore)
  224. end
  225.  
  226. while true do
  227. self.WallCheckParams.FilterDescendantsInstances = thisignore --//Copies
  228. local result = Raycast(workspace, origin, dir, self.WallCheckParams)
  229.  
  230. if result then
  231. if self.IgnoreTransparent and result.Instance.ClassName ~= "Terrain" and result.Instance.Transparency >= self.TransparencyThreshold then
  232. table.insert(thisignore, result.Instance)
  233. continue
  234. end
  235.  
  236. self.WallCheckParams.FilterDescendantsInstances = self.DefaultIgnore
  237. return result.Instance
  238. end
  239.  
  240. self.WallCheckParams.FilterDescendantsInstances = self.DefaultIgnore
  241. return nil
  242. end
  243. end
  244.  
  245. --//Gets target from viewport point
  246. function Aimbot:GetTargetFromViewportPoint(point, distance, ignore)
  247. local camera = self.Camera
  248.  
  249. if camera then
  250. local ray = ViewportPointToRay(camera, point.X, point.Y)
  251. return self:GetBlockingPart(ray.Origin, ray.Origin + ray.Direction * distance, ignore)
  252. end
  253. end
  254.  
  255. --//Gets closest edge on part from viewport point
  256. function Aimbot:GetClosestEdgeFromViewportPoint(point, part)
  257. local camera = self.Camera
  258.  
  259. if camera then
  260. local Blacklisted = {
  261. ["Right Arm"] = "LeftSurface",
  262. ["Left Arm"] = "RightSurface",
  263. ["Right Leg"] = "TopSurface",
  264. ["Left Leg"] = "TopSurface",
  265. ["Head"] = "BottomSurface"
  266. }
  267.  
  268. local ray = ViewportPointToRay(camera, point.X, point.Y)
  269. local ppos = part.Position
  270.  
  271. local dist = (ray.Origin - ppos).Magnitude
  272. local dir = (ray.Origin + ray.Direction * dist - ppos).Unit
  273.  
  274. local size = part.Size
  275.  
  276. local half = size / 2
  277. local final = dir * size
  278.  
  279. local Pos = ppos + Vector3.new(
  280. final.X < 0 and math.max(final.X, -half.X + size.X / 10) or math.min(final.X, half.X - size.X / 10),
  281. final.Y < 0 and math.max(final.Y, -half.Y + size.Y / 10) or math.min(final.Y, half.Y - size.Y / 10),
  282. final.Z < 0 and math.max(final.Z, -half.Z + size.Z / 10) or math.min(final.Z, half.Z - size.Z / 10)
  283. )
  284.  
  285. local g = {
  286. TopSurface = part.CFrame * CFrame.new(0, part.Size.Y / 2, 0) * CFrame.Angles(math.pi / 2, 0, 0),
  287. BottomSurface = part.CFrame * CFrame.new(0, part.Size.Y / -2, 0) * CFrame.Angles(math.pi / -2, 0, 0),
  288. FrontSurface = part.CFrame * CFrame.new(0, 0, part.Size.Z / -2),
  289. BackSurface = part.CFrame * CFrame.new(0, 0, part.Size.Z / 2) * CFrame.Angles(0, math.pi, 0),
  290. LeftSurface = part.CFrame * CFrame.new(part.Size.X / -2, 0, 0) * CFrame.Angles(0, math.pi / 2, 0),
  291. RightSurface = part.CFrame * CFrame.new(part.Size.X / 2, 0, 0) * CFrame.Angles(0, math.pi / -2, 0)
  292. }
  293.  
  294. local closest = math.huge
  295. local new = nil
  296. for i,v in pairs(g) do
  297. local h = (Pos - v.Position).Magnitude
  298. if h < closest then
  299. new = i
  300. closest = h
  301. end
  302. end
  303.  
  304. if Blacklisted[part.Name] ~= new then
  305. return Pos
  306. end
  307. end
  308. end
  309.  
  310. --//Gets mouse location with offset accounted for
  311. function Aimbot:GetMouseViewportPoint()
  312. return GetMouseLocation(UserInputService) + self.Offset
  313. end
  314.  
  315. --//Gets best target from a list of parts and a viewport point, ignoreparent specifies whether to filter the entire parent
  316. function Aimbot:GetBestPartFromViewportPoint(position, parts, ignoreparent, ignore)
  317. local camera = self.Camera
  318.  
  319. if camera then
  320. local len = #parts
  321.  
  322. if len > 0 then
  323. local leastbias, leastwdist, leastpdist, part = math.huge, math.huge, math.huge, nil
  324. local campos = camera.CFrame.Position
  325.  
  326. ignore = ignore or {}
  327. local ipos = #ignore + 1
  328.  
  329. for i = 1, len do
  330. local cpart = parts[i]
  331. local cpos = cpart.Position
  332.  
  333. local point, onscreen = WorldToViewportPoint(camera, cpos)
  334. ignore[ipos] = ignoreparent and cpart.Parent or cpart
  335.  
  336. if onscreen and not self:GetBlockingPart(campos, cpos, ignore) then
  337. local pdist = (position - Vector2.new(point.X, point.Y)).Magnitude --//Pixel Distance
  338. local wdist = (campos - cpos).Magnitude --//World Distance
  339. 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)
  340.  
  341.  
  342. if pdist <= self:GetRadiusAtDistance(self.Targets[playerOb] and self.RadiusPercentAt1 or self.FlickSettings.RadiusPercentAt1, wdist) then
  343. local bias = self:GetBiasAtDistance(wdist) + pdist
  344.  
  345. if bias < leastbias or (bias == leastbias and wdist < leastwdist) then
  346. leastbias = bias
  347. leastwdist = wdist
  348. leastpdist = pdist
  349. part = cpart
  350. end
  351. end
  352. end
  353. end
  354.  
  355. ignore[ipos] = nil
  356. return part, part and leastpdist <= self:GetRadiusAtDistance(self.SilentRadiusPercentAt1, leastwdist)
  357. end
  358. end
  359. end
  360.  
  361. --//Gets best player to target based on a viewport point
  362. function Aimbot:GetBestPlayerTargetFromViewportPoint(pos)
  363. if self.Camera then
  364. local plrs = GetPlayers(Players)
  365. local len = #plrs
  366.  
  367. if len > 0 then
  368. local parts = {}
  369. local lparts = 1
  370. local maxPlr = {}
  371. for i = 1, len do
  372. local plr = plrs[i]
  373. local charac = plr.Character
  374.  
  375. if plr ~= LocalPlayer and charac then
  376. if self.TeamCheck and not plr.Neutral and plr.Team == LocalPlayer.Team then
  377. continue
  378. end
  379.  
  380. if self.IsAliveCheck then
  381. local hum = FindFirstChildOfClass(charac, "Humanoid")
  382.  
  383. if not hum or hum.Health <= 0 then
  384. continue
  385. end
  386. end
  387.  
  388. if self.InvisibleCheck then
  389. local head = FindFirstChild(charac, "Head")
  390.  
  391. if not head or head.Transparency >= 1 then
  392. continue
  393. end
  394. end
  395.  
  396. if self.SizeCheck then
  397. local hum = FindFirstChild(charac, "HumanoidRootPart")
  398.  
  399. if not hum or hum.Size.X < 2 or hum.Size.Y < 2 or hum.Size.Z < 1 then
  400. continue
  401. end
  402. end
  403.  
  404. if self.AntiLag then
  405. if #maxPlr >= 4 then continue end
  406. table.insert(maxPlr, plr)
  407. end
  408.  
  409. local filtered = GetChildrenWhichIsA(charac, "BasePart")
  410. local lfiltered = #filtered
  411.  
  412. table.move(filtered, 1, lfiltered, lparts, parts)
  413. lparts = lparts + lfiltered
  414. end
  415. end
  416. local target, silent = self:GetBestPartFromViewportPoint(pos, parts, true)
  417. local plrz = target and game:GetService("Players"):GetPlayerFromCharacter(target.Parent) or "nil"
  418. for aa, _ in pairs(self.Targets) do
  419. if aa ~= plrz then self.Targets[aa] = false end
  420. end
  421. if target then
  422. return target, silent
  423. end
  424. end
  425. end
  426. end
  427.  
  428. --//Begins aimbot
  429.  
  430. function Aimbot:Start()
  431. self.Enabled = true
  432. self.LastTrigger = 0
  433. self.TriggerPaused = false
  434. self.Targets = {}; setmetatable(self.Targets, {__index = function(s, k)
  435. s[k] = false
  436. return false
  437. end})
  438.  
  439. local relative
  440. local holding = false
  441. local mspoof
  442.  
  443. local peaking = false
  444. local lastframe = getclock()
  445.  
  446. if not self.RenderStep then
  447. local lastt = 0
  448. local fdelt = 0.016666666666666666
  449.  
  450. self.RenderStep = Connect(RunService.RenderStepped, function(delta)
  451. local timee = tick()
  452. if timee > lastt + fdelt or (1 / delta < 60) then
  453. if self.Enabled and relative then
  454. if self.HoldControl and self.Holding or not self.HoldControl then
  455. --mousemoverel(relative.X, relative.Y)
  456. local pos, onScreen = WorldToViewportPoint(self.Camera, relative.Position)
  457. if onScreen and pos then
  458. local g = (Vector2.new(pos.X, pos.Y) - self:GetMouseViewportPoint()) / Vector2.new(self.XSmoothingPercent * self.WidthFactor, self.YSmoothingPercent * self.WidthFactor)
  459. mousemoverel(g.X, g.Y)
  460. end
  461. end
  462. end
  463. end
  464. end)
  465. end
  466.  
  467. if not self.Heartbeat then
  468. local lastt = 0
  469. local fdelt = 0.016666666666666666
  470. self.Heartbeat = Connect(RunService.Heartbeat, function(delta)
  471. local timee = tick()
  472. if timee > lastt + fdelt or (1 / delta < 60) then
  473. lastt = timee
  474. relative = nil
  475. if self.Enabled then
  476. local camera = self.Camera
  477.  
  478. if camera then
  479. local mpos = self:GetMouseViewportPoint()
  480. local target, silent = self:GetBestPlayerTargetFromViewportPoint(mpos)
  481.  
  482. if not target then
  483. if holding then
  484. holding = false
  485. mouse1release()
  486. end
  487. end
  488.  
  489. if target then
  490. local charac = target.Parent
  491. local plrz = game:GetService("Players"):GetPlayerFromCharacter(charac)
  492. local lcharac = LocalPlayer.Character
  493. local cignore = GetChildrenWhichIsNotA(charac, "BasePart")
  494.  
  495. --if cignore then
  496. table.insert(cignore, lcharac)
  497. local mtarget = self:GetTargetFromViewportPoint(mpos, 5000, cignore)
  498. local bodyPart = (FindFirstChild(lcharac, "Head") or FindFirstChild(lcharac, "HumanoidRootPart"))
  499. local BlockingParts = self:GetBlockingPart(bodyPart and bodyPart.Position, target.Position, cignore)
  500. if silent and self.TriggerBot and lcharac and BlockingParts and BlockingParts:IsDescendantOf(charac) then
  501. if not holding then
  502. holding = true
  503. mouse1press()
  504.  
  505.  
  506. if self.AutoPeak.PointPosition and not peaking then
  507. local hum = lcharac and FindFirstChildOfClass(lcharac, "Humanoid")
  508.  
  509. if hum then
  510. peaking = true
  511.  
  512. Controls:Disable()
  513. MoveTo(hum, self.AutoPeak.PointPosition)
  514.  
  515. local moveconn
  516. moveconn = Connect(hum.MoveToFinished, function()
  517. moveconn:Disconnect()
  518. moveconn = nil
  519.  
  520. Controls:Enable()
  521. peaking = false
  522. end)
  523.  
  524. task.delay(8, function()
  525. if moveconn then
  526. moveconn:Disconnect()
  527. moveconn = nil
  528.  
  529. Controls:Enable()
  530. peaking = false
  531. end
  532. end)
  533. end
  534. end
  535. else
  536. if self.TriggerBotSemi and (tick() - self.LastTrigger) >= self.TriggerBotTimeBetweenClick and not self.TriggerPaused then
  537. self.TriggerPaused = true
  538. task.wait(self.TriggerBotTime / 1000)
  539. mouse1press()
  540. self.LastTrigger = tick()
  541. self.TriggerPaused = false
  542. end
  543. end
  544. elseif silent and self.TriggerBot and lcharac and (not BlockingParts or not BlockingParts:IsDescendantOf(charac)) then
  545. if holding then
  546. holding = false
  547. mouse1release()
  548. end
  549. end
  550.  
  551. if mtarget and IsDescendantOf(mtarget, charac) then
  552. mspoof = nil
  553. self.Targets[plrz] = true
  554. elseif silent then
  555. mspoof = self:GetClosestEdgeFromViewportPoint(mpos, target)
  556. else
  557. mspoof = nil
  558. end
  559.  
  560. if self.Targets[plrz] then
  561. if self.Deadzone.Enabled then
  562. target = (self.TargetPart and FindFirstChild(charac, self.TargetPart)) or target
  563. local pos, onscreen = WorldToViewportPoint(camera, target.Position)
  564. if onscreen and not self.Disabled then
  565. local g = (Vector2.new(pos.X, pos.Y) - mpos) / Vector2.new(self.Deadzone.XSmoothingPercent * self.WidthFactor, self.Deadzone.YSmoothingPercent * self.WidthFactor)
  566. mousemoverel(g.X, g.Y)
  567. end
  568. end
  569. end
  570.  
  571.  
  572. local function getClosestBodyPartToMouse()
  573. local closestPart = nil
  574. local closestDistance = math.huge
  575.  
  576. for i,v in pairs(GetDescendantsWhichIsA(charac, "BasePart")) do
  577. local pos, onScreen = WorldToViewportPoint(camera, v.Position)
  578. if onScreen then
  579. local pdist = (self:GetMouseViewportPoint() - Vector2.new(pos.X, pos.Y)).Magnitude
  580. if pdist < closestDistance then
  581. closestDistance = pdist
  582. closestPart = v
  583. end
  584. end
  585. end
  586.  
  587. return closestPart
  588. end
  589.  
  590. target = (self.TargetPart and FindFirstChild(charac, self.TargetPart)) or getClosestBodyPartToMouse()
  591. --local pos, onscreen = WorldToViewportPoint(camera, target.Position)
  592. local g = self:GetClosestEdgeFromViewportPoint(mpos, target)
  593. if g then
  594.  
  595. local pos, onscreen = WorldToViewportPoint(camera, g)
  596. if onscreen and not self.Disabled then
  597. local mpos = self:GetMouseViewportPoint()
  598. local mtarget = self:GetTargetFromViewportPoint(mpos, 5000, cignore)
  599. if self.Targets[plrz] and not (mtarget and mtarget.Name == "Head") then
  600. relative = target
  601. --relative = (Vector2.new(pos.X, pos.Y) - mpos) / Vector2.new(self.XSmoothingPercent * self.WidthFactor, self.YSmoothingPercent * self.WidthFactor)
  602. else
  603. if self.FlickSettings.Flick and not (mtarget and mtarget.Name == "Head") then
  604. relative = target
  605. --relative = (Vector2.new(pos.X, pos.Y) - mpos) / Vector2.new(self.FlickSettings.FlickXSmoothingPercent * self.WidthFactor, self.FlickSettings.FlickYSmoothingPercent * self.WidthFactor)
  606. end
  607. end
  608. end
  609. end
  610. else
  611. if holding then
  612. holding = false
  613. mouse1release()
  614. end
  615.  
  616. mspoof = nil
  617. end
  618. else
  619. if holding then
  620. holding = false
  621. mouse1release()
  622. end
  623.  
  624. mspoof = nil
  625. end
  626. else
  627. if holding then
  628. holding = false
  629. mouse1release()
  630. end
  631.  
  632. mspoof = nil
  633. end
  634. end
  635. end)
  636. end
  637.  
  638. self.InputConnection = Connect(UserInputService.InputBegan, function(key)
  639. if self.Enabled and self.AutoPeak.Enabled and key.UserInputType == Enum.UserInputType.MouseButton3 then
  640. local root = LocalPlayer.Character and FindFirstChild(LocalPlayer.Character, "HumanoidRootPart")
  641.  
  642. if root then
  643. self.AutoPeak.PointPosition = not self.AutoPeak.PointPosition and root.Position or nil
  644. end
  645. end
  646. end)
  647.  
  648. local Players2 = game.GetService(game, "Players");
  649. local Client2 = Players2.LocalPlayer;
  650. local Mouse2 = Client2.GetMouse(Client2);
  651.  
  652. local old; old = hookmetamethod(game, "__index", newcclosure(function(i,v)
  653. if string.lower(v) == "hit" then
  654. if old(i, "ClassName") == "Mouse" or old(i, "ClassName") == "PlayerMouse" then
  655. if not checkcaller() then
  656. if mspoof then
  657. return CFrame.new(mspoof)
  658. end
  659. end
  660. end
  661. end
  662. return old(i,v)
  663. end))
  664.  
  665. local old2; old2 = hookmetamethod(game, "__namecall", newcclosure(function(self2, ...)
  666. if getnamecallmethod() == "ViewportPointToRay" and not checkcaller() and mspoof then
  667. local args = {...}
  668. local pos = GetMouseLocation(UserInputService)
  669. if math.abs(args[1] - (pos.X + self.Offset.X)) <= 3 and math.abs(args[2] - (pos.Y + self.Offset.Y)) <= 3 then
  670. local newPos = workspace.CurrentCamera.WorldToViewportPoint(workspace.CurrentCamera, mspoof)
  671. args[1] = newPos.X
  672. args[2] = newPos.Y
  673. return old2(self2, table.unpack(args))
  674. else
  675. if math.abs(args[1] - (Mouse2.X + self.Offset.X)) <= 3 and math.abs(args[2] - (Mouse2.Y + self.Offset.Y)) <= 3 then
  676. local newPos = workspace.CurrentCamera.WorldToViewportPoint(workspace.CurrentCamera, mspoof)
  677. args[1] = newPos.X
  678. args[2] = newPos.Y
  679. return old2(self2, table.unpack(args))
  680. end
  681. end
  682. elseif getnamecallmethod() == "ScreenPointToRay" and not checkcaller() and mspoof then
  683. local args = {...}
  684. local pos = GetMouseLocation(UserInputService)
  685. if math.abs(args[1] - (pos.X + self.Offset.X)) <= 3 and math.abs(args[2] - (pos.Y + self.Offset.Y)) <= 3 then
  686. local newPos = workspace.CurrentCamera.WorldToScreenPoint(workspace.CurrentCamera, mspoof)
  687. args[1] = newPos.X
  688. args[2] = newPos.Y
  689. return old2(self2, table.unpack(args))
  690. else
  691. if math.abs(args[1] - (Mouse2.X + self.Offset.X)) <= 3 and math.abs(args[2] - (Mouse2.Y + self.Offset.Y)) <= 3 then
  692. local newPos = workspace.CurrentCamera.WorldToScreenPoint(workspace.CurrentCamera, mspoof)
  693. args[1] = newPos.X
  694. args[2] = newPos.Y
  695. return old2(self2, table.unpack(args))
  696. end
  697. end
  698. end
  699. return old2(self2, ...)
  700. end))
  701.  
  702. --[[
  703. local old2; old2 = hookmetamethod(game, "__namecall", function(self2, ...)
  704. local args = {...}
  705. if getnamecallmethod() == "ScreenPointToRay" or getnamecallmethod() == "ViewportPointToRay" and mspoof then
  706. local SecondPosition = game.GetService(game, "UserInputService").GetMouseLocation(game.GetService(game, "UserInputService"))
  707. if args[1] == Mouse2.X and args[2] == Mouse2.Y or args[1] == SecondPosition.X and args[2] == SecondPosition.Y then
  708. local newPos = workspace.CurrentCamera.WorldToScreenPoint(workspace.CurrentCamera, mspoof)
  709. args[1] = newPos.X
  710. args[2] = newPos.Y
  711. return old2(self2, table.unpack(args))
  712. end
  713. end
  714. return old2(self2, ...)
  715. end)
  716. --]]
  717. end
  718.  
  719. --//Completely kills aimbot, as opposed to enabled = false
  720. function Aimbot:Kill()
  721. self.Enabled = false
  722.  
  723. if self.RenderStep then
  724. Disconnect(self.RenderStep)
  725. self.RenderStep = nil
  726. end
  727.  
  728. if self.Heartbeat then
  729. Disconnect(self.Heartbeat)
  730. self.Heartbeat = nil
  731. end
  732.  
  733. if self.InputConnection then
  734. Disconnect(self.InputConnection)
  735. self.InputConnection = nil
  736. end
  737. end
  738.  
  739. --//Constructor
  740. function Aimbot.new(presets)
  741. presets = presets or {}
  742. UpdateTable(presets, Aimbot.DefaultSettings)
  743.  
  744. local WallCheckParams = RaycastParams.new()
  745. WallCheckParams.FilterType = Enum.RaycastFilterType.Blacklist
  746. WallCheckParams.IgnoreWater = presets.IgnoreWater
  747. WallCheckParams.FilterDescendantsInstances = presets.DefaultIgnore
  748.  
  749. presets.WallCheckParams = WallCheckParams
  750. return setmetatable(presets, Aimbot)
  751. end
  752.  
  753. --//Return with default settings
  754. return Aimbot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement