Advertisement
eruaaaaaaa

Untitled

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