Advertisement
eruaaaaaaa

Untitled

Dec 30th, 2022 (edited)
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.96 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.  
  314. Aimbot.MouseSlowed = false
  315.  
  316. function Aimbot:Slow(state)
  317. print(state == true and "slowing down" or "reverting")
  318.  
  319. if state == false and self.MouseSlowed == true then
  320. keyrelease(0x70)
  321. self.MouseSlowed = false
  322. end
  323.  
  324. if state == true and self.MouseSlowed == false then
  325. keypress(0x70)
  326. self.MouseSlowed = true
  327. end
  328. end
  329.  
  330. function Aimbot:GetMouseViewportPoint()
  331. return GetMouseLocation(UserInputService) + self.Offset
  332. end
  333.  
  334. --//Gets best target from a list of parts and a viewport point, ignoreparent specifies whether to filter the entire parent
  335. function Aimbot:GetBestPartFromViewportPoint(position, parts, ignoreparent, ignore)
  336. local camera = self.Camera
  337.  
  338. if camera then
  339. local len = #parts
  340.  
  341. if len > 0 then
  342. local leastbias, leastwdist, leastpdist, part = math.huge, math.huge, math.huge, nil
  343. local campos = camera.CFrame.Position
  344.  
  345. ignore = ignore or {}
  346. local ipos = #ignore + 1
  347.  
  348. for i = 1, len do
  349. local cpart = parts[i]
  350. local cpos = cpart.Position
  351.  
  352. local point, onscreen = WorldToViewportPoint(camera, cpos)
  353. ignore[ipos] = ignoreparent and cpart.Parent or cpart
  354.  
  355. if onscreen and not self:GetBlockingPart(campos, cpos, ignore) then
  356. local pdist = (position - Vector2.new(point.X, point.Y)).Magnitude --//Pixel Distance
  357. local wdist = (campos - cpos).Magnitude --//World Distance
  358. 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)
  359.  
  360.  
  361. if pdist <= self:GetRadiusAtDistance(self.Targets[playerOb] and self.RadiusPercentAt1 or self.FlickSettings.RadiusPercentAt1, wdist) then
  362. local bias = self:GetBiasAtDistance(wdist) + pdist
  363.  
  364. if bias < leastbias or (bias == leastbias and wdist < leastwdist) then
  365. leastbias = bias
  366. leastwdist = wdist
  367. leastpdist = pdist
  368. part = cpart
  369. end
  370. end
  371. end
  372. end
  373.  
  374. ignore[ipos] = nil
  375. return part, part and leastpdist <= self:GetRadiusAtDistance(self.SilentRadiusPercentAt1, leastwdist)
  376. end
  377. end
  378. end
  379.  
  380. --//Gets best player to target based on a viewport point
  381. function Aimbot:GetBestPlayerTargetFromViewportPoint(pos)
  382. if self.Camera then
  383. local plrs = GetPlayers(Players)
  384. local len = #plrs
  385.  
  386. if len > 0 then
  387. local parts = {}
  388. local lparts = 1
  389. local maxPlr = {}
  390. for i = 1, len do
  391. local plr = plrs[i]
  392. local charac = plr.Character
  393.  
  394. if plr ~= LocalPlayer and charac then
  395. if self.TeamCheck and not plr.Neutral and plr.Team == LocalPlayer.Team then
  396. continue
  397. end
  398.  
  399. if self.IsAliveCheck then
  400. local hum = FindFirstChildOfClass(charac, "Humanoid")
  401.  
  402. if not hum or hum.Health <= 0 then
  403. continue
  404. end
  405. end
  406.  
  407. if self.InvisibleCheck then
  408. local head = FindFirstChild(charac, "Head")
  409.  
  410. if not head or head.Transparency >= 1 then
  411. continue
  412. end
  413. end
  414.  
  415. if self.SizeCheck then
  416. local hum = FindFirstChild(charac, "HumanoidRootPart")
  417.  
  418. if not hum or hum.Size.X < 2 or hum.Size.Y < 2 or hum.Size.Z < 1 then
  419. continue
  420. end
  421. end
  422.  
  423. if self.AntiLag then
  424. if #maxPlr >= 4 then continue end
  425. table.insert(maxPlr, plr)
  426. end
  427.  
  428. local filtered = GetChildrenWhichIsA(charac, "BasePart")
  429. local lfiltered = #filtered
  430.  
  431. table.move(filtered, 1, lfiltered, lparts, parts)
  432. lparts = lparts + lfiltered
  433. end
  434. end
  435. local target, silent = self:GetBestPartFromViewportPoint(pos, parts, true)
  436. local plrz = target and game:GetService("Players"):GetPlayerFromCharacter(target.Parent) or "nil"
  437. for aa, _ in pairs(self.Targets) do
  438. if aa ~= plrz then self.Targets[aa] = false end
  439. end
  440.  
  441. if target then
  442. return target, silent
  443. end
  444. end
  445. end
  446. end
  447.  
  448. --//Begins aimbot
  449.  
  450. function Aimbot:Start()
  451. self.Enabled = true
  452. self.LastTrigger = 0
  453. self.TriggerPaused = false
  454. self.Targets = {}; setmetatable(self.Targets, {__index = function(s, k)
  455. s[k] = false
  456. return false
  457. end})
  458.  
  459. local relative
  460. local holding = false
  461. local mspoof
  462.  
  463. local peaking = false
  464. local lastframe = getclock()
  465.  
  466. if not self.RenderStep then
  467. local sum = 0
  468.  
  469. self.RenderStep = Connect(RunService.RenderStepped, function(delta)
  470. sum = sum + delta
  471.  
  472. if sum >= 1 / 60 then
  473. if self.Enabled and relative then
  474. if self.HoldControl and self.Holding or not self.HoldControl then
  475. mousemoverel(relative.X, relative.Y)
  476. relative = nil
  477. end
  478. end
  479.  
  480. sum = sum - 1 / 60
  481. end
  482. end)
  483. end
  484.  
  485. if not self.Heartbeat then
  486. local sum = 0
  487. self.Heartbeat = Connect(RunService.Heartbeat, function(delta)
  488.  
  489. if self.Enabled then
  490. local camera = self.Camera
  491.  
  492. if camera then
  493. local mpos = self:GetMouseViewportPoint()
  494. local target, silent = self:GetBestPlayerTargetFromViewportPoint(mpos)
  495.  
  496. if not target then
  497. if holding then
  498. holding = false
  499. mouse1release()
  500. end
  501. end
  502.  
  503. if target then
  504. local charac = target.Parent
  505. local plrz = game:GetService("Players"):GetPlayerFromCharacter(charac)
  506. local lcharac = LocalPlayer.Character
  507. local cignore = GetChildrenWhichIsNotA(charac, "BasePart")
  508.  
  509. --if cignore then
  510. table.insert(cignore, lcharac)
  511. local mtarget = self:GetTargetFromViewportPoint(mpos, 5000, cignore)
  512. local bodyPart = (FindFirstChild(lcharac, "Head") or FindFirstChild(lcharac, "HumanoidRootPart"))
  513. local BlockingParts = self:GetBlockingPart(bodyPart and bodyPart.Position, target.Position, cignore)
  514. if silent and self.TriggerBot and lcharac and BlockingParts and BlockingParts:IsDescendantOf(charac) then
  515. if not holding then
  516. holding = true
  517. mouse1press()
  518.  
  519.  
  520. if self.AutoPeak.PointPosition and not peaking then
  521. local hum = lcharac and FindFirstChildOfClass(lcharac, "Humanoid")
  522.  
  523. if hum then
  524. peaking = true
  525.  
  526. Controls:Disable()
  527. MoveTo(hum, self.AutoPeak.PointPosition)
  528.  
  529. local moveconn
  530. moveconn = Connect(hum.MoveToFinished, function()
  531. moveconn:Disconnect()
  532. moveconn = nil
  533.  
  534. Controls:Enable()
  535. peaking = false
  536. end)
  537.  
  538. task.delay(8, function()
  539. if moveconn then
  540. moveconn:Disconnect()
  541. moveconn = nil
  542.  
  543. Controls:Enable()
  544. peaking = false
  545. end
  546. end)
  547. end
  548. end
  549. else
  550. if self.TriggerBotSemi and (tick() - self.LastTrigger) >= self.TriggerBotTimeBetweenClick and not self.TriggerPaused then
  551. self.TriggerPaused = true
  552. task.wait(self.TriggerBotTime / 1000)
  553. mouse1press()
  554. self.LastTrigger = tick()
  555. self.TriggerPaused = false
  556. end
  557. end
  558. elseif silent and self.TriggerBot and lcharac and (not BlockingParts or not BlockingParts:IsDescendantOf(charac)) then
  559. if holding then
  560. holding = false
  561. mouse1release()
  562. end
  563. end
  564.  
  565. if mtarget and IsDescendantOf(mtarget, charac) then
  566. mspoof = nil
  567. 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
  568. self.Targets[plrz] = true
  569. end
  570. elseif silent then
  571. mspoof = self:GetClosestEdgeFromViewportPoint(mpos, target)
  572. else
  573. mspoof = nil
  574. end
  575.  
  576. if self.Targets[plrz] then
  577. if self.Deadzone.Enabled then
  578. target = (self.TargetPart and FindFirstChild(charac, self.TargetPart)) or target
  579. local pos, onscreen = WorldToViewportPoint(camera, target.Position)
  580. if onscreen and not self.Disabled then
  581. local g = (Vector2.new(pos.X, pos.Y) - mpos) / Vector2.new(self.Deadzone.XSmoothingPercent * self.WidthFactor, self.Deadzone.YSmoothingPercent * self.WidthFactor)
  582. mousemoverel(g.X, g.Y)
  583. end
  584. end
  585. end
  586.  
  587. --local pos, onscreen = WorldToViewportPoint(camera, target.Position)
  588.  
  589. if self.Targets[plrz] then
  590. self:Slow(true)
  591. else
  592. self:Slow(false)
  593. end
  594.  
  595. local g = self.TargetPart and charac:FindFirstChild(self.TargetPart).Position or charac:FindFirstChild("HumanoidRootPart").Position
  596. if g then
  597.  
  598. local pos, onscreen = WorldToViewportPoint(camera, g)
  599. if onscreen and not self.Disabled then
  600. local mpos = self:GetMouseViewportPoint()
  601. local mtarget = self:GetTargetFromViewportPoint(mpos, 5000, cignore)
  602.  
  603. 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
  604. if self.Targets[plrz] then
  605. local displ = (Vector2.new(pos.X, pos.Y) - mpos)
  606. local smoothing = Vector2.new(self.XSmoothingPercent * self.WidthFactor, self.YSmoothingPercent * self.WidthFactor)
  607. local rel = Vector2.new(displ.X, displ.Y) / smoothing
  608.  
  609. 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
  610. 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
  611.  
  612. relative = Vector2.new(rX, rY)
  613. else
  614. if self.FlickSettings.Flick then
  615. local displ = (Vector2.new(pos.X, pos.Y) - mpos)
  616. local smoothing = Vector2.new(self.FlickSettings.FlickXSmoothingPercent * self.WidthFactor, self.FlickSettings.FlickYSmoothingPercent * self.WidthFactor)
  617. local rel = Vector2.new(displ.X, displ.Y) / smoothing
  618.  
  619. 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
  620. 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
  621.  
  622. relative = Vector2.new(rX, rY)
  623. end
  624. end
  625. end
  626. end
  627. end
  628. else
  629. if holding then
  630. holding = false
  631. mouse1release()
  632. end
  633.  
  634. mspoof = nil
  635. self:Slow(false)
  636. end
  637. else
  638. if holding then
  639. holding = false
  640. mouse1release()
  641. end
  642.  
  643. mspoof = nil
  644. end
  645. else
  646. if holding then
  647. holding = false
  648. mouse1release()
  649. end
  650.  
  651. mspoof = nil
  652. end
  653. end)
  654. end
  655.  
  656. self.InputConnection = Connect(UserInputService.InputBegan, function(key)
  657. if self.Enabled and self.AutoPeak.Enabled and key.UserInputType == Enum.UserInputType.MouseButton3 then
  658. local root = LocalPlayer.Character and FindFirstChild(LocalPlayer.Character, "HumanoidRootPart")
  659.  
  660. if root then
  661. self.AutoPeak.PointPosition = not self.AutoPeak.PointPosition and root.Position or nil
  662. end
  663. end
  664. end)
  665.  
  666. local Players2 = game.GetService(game, "Players");
  667. local Client2 = Players2.LocalPlayer;
  668. local Mouse2 = Client2.GetMouse(Client2);
  669.  
  670. local old; old = hookmetamethod(game, "__index", newcclosure(function(i,v)
  671. if string.lower(v) == "hit" then
  672. if old(i, "ClassName") == "Mouse" or old(i, "ClassName") == "PlayerMouse" then
  673. if not checkcaller() then
  674. if mspoof then
  675. return CFrame.new(mspoof)
  676. end
  677. end
  678. end
  679. end
  680. return old(i,v)
  681. end))
  682.  
  683. local old2; old2 = hookmetamethod(game, "__namecall", newcclosure(function(self2, ...)
  684. if getnamecallmethod() == "ViewportPointToRay" and not checkcaller() and mspoof then
  685. local args = {...}
  686. local pos = GetMouseLocation(UserInputService)
  687. if math.abs(args[1] - (pos.X + self.Offset.X)) <= 3 and math.abs(args[2] - (pos.Y + self.Offset.Y)) <= 3 then
  688. local newPos = workspace.CurrentCamera.WorldToViewportPoint(workspace.CurrentCamera, mspoof)
  689. args[1] = newPos.X
  690. args[2] = newPos.Y
  691. return old2(self2, table.unpack(args))
  692. else
  693. if math.abs(args[1] - (Mouse2.X + self.Offset.X)) <= 3 and math.abs(args[2] - (Mouse2.Y + self.Offset.Y)) <= 3 then
  694. local newPos = workspace.CurrentCamera.WorldToViewportPoint(workspace.CurrentCamera, mspoof)
  695. args[1] = newPos.X
  696. args[2] = newPos.Y
  697. return old2(self2, table.unpack(args))
  698. end
  699. end
  700. elseif getnamecallmethod() == "ScreenPointToRay" and not checkcaller() and mspoof then
  701. local args = {...}
  702. local pos = GetMouseLocation(UserInputService)
  703. if math.abs(args[1] - (pos.X + self.Offset.X)) <= 3 and math.abs(args[2] - (pos.Y + self.Offset.Y)) <= 3 then
  704. local newPos = workspace.CurrentCamera.WorldToScreenPoint(workspace.CurrentCamera, mspoof)
  705. args[1] = newPos.X
  706. args[2] = newPos.Y
  707. return old2(self2, table.unpack(args))
  708. else
  709. if math.abs(args[1] - (Mouse2.X + self.Offset.X)) <= 3 and math.abs(args[2] - (Mouse2.Y + self.Offset.Y)) <= 3 then
  710. local newPos = workspace.CurrentCamera.WorldToScreenPoint(workspace.CurrentCamera, mspoof)
  711. args[1] = newPos.X
  712. args[2] = newPos.Y
  713. return old2(self2, table.unpack(args))
  714. end
  715. end
  716. end
  717. return old2(self2, ...)
  718. end))
  719.  
  720. --[[
  721. local old2; old2 = hookmetamethod(game, "__namecall", function(self2, ...)
  722. local args = {...}
  723. if getnamecallmethod() == "ScreenPointToRay" or getnamecallmethod() == "ViewportPointToRay" and mspoof then
  724. local SecondPosition = game.GetService(game, "UserInputService").GetMouseLocation(game.GetService(game, "UserInputService"))
  725. if args[1] == Mouse2.X and args[2] == Mouse2.Y or args[1] == SecondPosition.X and args[2] == SecondPosition.Y then
  726. local newPos = workspace.CurrentCamera.WorldToScreenPoint(workspace.CurrentCamera, mspoof)
  727. args[1] = newPos.X
  728. args[2] = newPos.Y
  729. return old2(self2, table.unpack(args))
  730. end
  731. end
  732. return old2(self2, ...)
  733. end)
  734. --]]
  735. end
  736.  
  737. --//Completely kills aimbot, as opposed to enabled = false
  738. function Aimbot:Kill()
  739. self.Enabled = false
  740.  
  741. if self.RenderStep then
  742. Disconnect(self.RenderStep)
  743. self.RenderStep = nil
  744. end
  745.  
  746. if self.Heartbeat then
  747. Disconnect(self.Heartbeat)
  748. self.Heartbeat = nil
  749. end
  750.  
  751. if self.InputConnection then
  752. Disconnect(self.InputConnection)
  753. self.InputConnection = nil
  754. end
  755. end
  756.  
  757. --//Constructor
  758. function Aimbot.new(presets)
  759. presets = presets or {}
  760. UpdateTable(presets, Aimbot.DefaultSettings)
  761.  
  762. local WallCheckParams = RaycastParams.new()
  763. WallCheckParams.FilterType = Enum.RaycastFilterType.Blacklist
  764. WallCheckParams.IgnoreWater = presets.IgnoreWater
  765. WallCheckParams.FilterDescendantsInstances = presets.DefaultIgnore
  766.  
  767. presets.WallCheckParams = WallCheckParams
  768. return setmetatable(presets, Aimbot)
  769. end
  770.  
  771. --//Return with default settings
  772. return Aimbot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement