Advertisement
eruaaaaaaa

Untitled

Jan 17th, 2023 (edited)
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.86 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. function Aimbot:PartToCorners(Part)
  447. local PartCFrame = Part.CFrame; do
  448. return {
  449. (PartCFrame * CFrame.new(-Part.Size.X / 2, 0, -Part.Size.Z / 2)).Position, -- neg x, neg z
  450. (PartCFrame * CFrame.new(Part.Size.X / 2, 0, -Part.Size.Z / 2)).Position, -- pos x, neg z
  451. (PartCFrame * CFrame.new(-Part.Size.X / 2, 0, Part.Size.Z / 2)).Position, -- neg x, pos z
  452. (PartCFrame * CFrame.new(Part.Size.X / 2, 0, Part.Size.Z / 2)).Position -- pos x, pos z
  453. }
  454. end
  455. end
  456.  
  457. function Aimbot:CornersToScreenPoint(Corners)
  458. local CornersToScreenPoint = {}
  459.  
  460. for i,v in pairs(Corners) do
  461. local point, isOnScreen = workspace.CurrentCamera:WorldToScreenPoint(v)
  462.  
  463. if isOnScreen then
  464. CornersToScreenPoint[i] = Vector2.new(point.X, point.Y)
  465. end
  466. end
  467.  
  468. return CornersToScreenPoint
  469. end
  470.  
  471. function Aimbot:GetLargestDistance(Part)
  472. local Corners = self:CornersToScreenPoint(self:PartToCorners(Part))
  473. local LargestDistance = -1
  474. local l1, l2
  475.  
  476. for i = 1, #Corners - 1 do
  477. for i2 = 2, #Corners do
  478. local CurrentDistance = math.abs(Corners[i].X - Corners[i2].X)
  479.  
  480. if CurrentDistance > LargestDistance then
  481. LargestDistance = CurrentDistance
  482. l1 = Corners[i]
  483. l2 = Corners[i2]
  484. end
  485. end
  486. end
  487.  
  488. return LargestDistance
  489. end
  490.  
  491. --//Begins aimbot
  492.  
  493. local Drawin = Drawing.new("Text")
  494.  
  495. Drawin.Text = "Not yet."
  496. Drawin.Visible = true
  497. Drawin.Size = 30
  498. Drawin.Color = Color3.fromRGB(0, 255, 0)
  499. Drawin.Transparency = 1
  500. Drawin.Position = Vector2.new(workspace.CurrentCamera.ViewportSize.X / 2, 50)
  501. Drawin.Center = true
  502.  
  503. function Aimbot:Start()
  504. self.Enabled = true
  505. self.LastTrigger = 0
  506. self.TriggerPaused = false
  507. self.Targets = {}; setmetatable(self.Targets, {__index = function(s, k)
  508. s[k] = false
  509. return false
  510. end})
  511.  
  512. local relative
  513. local holding = false
  514. local mspoof
  515.  
  516. local peaking = false
  517. local lastframe = getclock()
  518.  
  519. if not self.RenderStep then
  520. local sum = 0
  521.  
  522. self.RenderStep = Connect(RunService.RenderStepped, function(delta)
  523. sum = sum + delta
  524.  
  525. if sum >= 1 / 60 then
  526. if self.Enabled and relative then
  527. if self.HoldControl and self.Holding or not self.HoldControl then
  528. mousemoverel(relative.X, relative.Y)
  529. relative = nil
  530. end
  531. end
  532.  
  533. sum = sum - 1 / 60
  534. end
  535. end)
  536. end
  537.  
  538. if not self.Heartbeat then
  539. local sum = 0
  540. self.Heartbeat = Connect(RunService.Heartbeat, function(delta)
  541.  
  542. if self.Enabled then
  543. local camera = self.Camera
  544.  
  545. if camera then
  546. local mpos = self:GetMouseViewportPoint()
  547. local target, silent = self:GetBestPlayerTargetFromViewportPoint(mpos)
  548.  
  549. if not target then
  550. if holding then
  551. holding = false
  552. mouse1release()
  553. end
  554. end
  555.  
  556. if target then
  557. local charac = target.Parent
  558. local plrz = game:GetService("Players"):GetPlayerFromCharacter(charac)
  559. local lcharac = LocalPlayer.Character
  560. local cignore = GetChildrenWhichIsNotA(charac, "BasePart")
  561.  
  562. --if cignore then
  563. table.insert(cignore, lcharac)
  564. local mtarget = self:GetTargetFromViewportPoint(mpos, 5000, cignore)
  565. local bodyPart = (FindFirstChild(lcharac, "Head") or FindFirstChild(lcharac, "HumanoidRootPart"))
  566. local BlockingParts = self:GetBlockingPart(bodyPart and bodyPart.Position, target.Position, cignore)
  567. if silent and self.TriggerBot and lcharac and BlockingParts and BlockingParts:IsDescendantOf(charac) then
  568. if not holding then
  569. holding = true
  570. mouse1press()
  571.  
  572.  
  573. if self.AutoPeak.PointPosition and not peaking then
  574. local hum = lcharac and FindFirstChildOfClass(lcharac, "Humanoid")
  575.  
  576. if hum then
  577. peaking = true
  578.  
  579. Controls:Disable()
  580. MoveTo(hum, self.AutoPeak.PointPosition)
  581.  
  582. local moveconn
  583. moveconn = Connect(hum.MoveToFinished, function()
  584. moveconn:Disconnect()
  585. moveconn = nil
  586.  
  587. Controls:Enable()
  588. peaking = false
  589. end)
  590.  
  591. task.delay(8, function()
  592. if moveconn then
  593. moveconn:Disconnect()
  594. moveconn = nil
  595.  
  596. Controls:Enable()
  597. peaking = false
  598. end
  599. end)
  600. end
  601. end
  602. else
  603. if self.TriggerBotSemi and (tick() - self.LastTrigger) >= self.TriggerBotTimeBetweenClick and not self.TriggerPaused then
  604. self.TriggerPaused = true
  605. task.wait(self.TriggerBotTime / 1000)
  606. mouse1press()
  607. self.LastTrigger = tick()
  608. self.TriggerPaused = false
  609. end
  610. end
  611. elseif silent and self.TriggerBot and lcharac and (not BlockingParts or not BlockingParts:IsDescendantOf(charac)) then
  612. if holding then
  613. holding = false
  614. mouse1release()
  615. end
  616. end
  617.  
  618. if mtarget and IsDescendantOf(mtarget, charac) then
  619. mspoof = nil
  620. self.Targets[plrz] = true
  621.  
  622. elseif silent then
  623. mspoof = self:GetClosestEdgeFromViewportPoint(mpos, target)
  624. else
  625. mspoof = nil
  626. end
  627.  
  628. if self.Targets[plrz] then
  629. if self.Deadzone.Enabled then
  630. target = (self.TargetPart and FindFirstChild(charac, self.TargetPart)) or target
  631. local pos, onscreen = WorldToViewportPoint(camera, target.Position)
  632. if onscreen and not self.Disabled then
  633. local g = (Vector2.new(pos.X, pos.Y) - mpos) / Vector2.new(self.Deadzone.XSmoothingPercent * self.WidthFactor, self.Deadzone.YSmoothingPercent * self.WidthFactor)
  634. mousemoverel(g.X, g.Y)
  635. end
  636. end
  637. end
  638.  
  639. --local pos, onscreen = WorldToViewportPoint(camera, target.Position)
  640. local g = self:GetClosestEdgeFromViewportPoint(mpos, target)
  641. if g then
  642.  
  643. local pos, onscreen = WorldToViewportPoint(camera, g)
  644. if onscreen and not self.Disabled then
  645. local mpos = self:GetMouseViewportPoint()
  646. local mtarget = self:GetTargetFromViewportPoint(mpos, 5000, cignore)
  647.  
  648. if not mtarget or not IsDescendantOf(mtarget, charac) then
  649. if self.Targets[plrz] then
  650. local wdistance = (target.Position - workspace.CurrentCamera.CFrame.Position).Magnitude
  651. local smoth = self:GetActualSmoothness(wdistance)
  652.  
  653. local distance1 = self:GetLargestDistance(target)
  654. local dt = distance1 / self.Threshold
  655.  
  656. local displ = (Vector2.new(pos.X, pos.Y) - mpos)
  657. local smoothing = Vector2.new(smoth * self.WidthFactor, smoth * self.WidthFactor) / dt
  658.  
  659. smoothing = Vector2.new(math.max(2, smoothing.X), math.max(2, smoothing.Y))
  660. Drawin.Text = smoothing.X.. " | lol"
  661.  
  662. local rel = Vector2.new(displ.X, displ.Y) / smoothing
  663.  
  664. relative = Vector2.new(rel.X, rel.Y)
  665. else
  666. if self.FlickSettings.Flick then
  667. local displ = (Vector2.new(pos.X, pos.Y) - mpos)
  668. local smoothing = Vector2.new(self.FlickSettings.FlickXSmoothingPercent * self.WidthFactor, self.FlickSettings.FlickYSmoothingPercent * self.WidthFactor)
  669. local rel = Vector2.new(displ.X, displ.Y) / smoothing
  670.  
  671. relative = Vector2.new(rel.X, rel.Y)
  672. end
  673. end
  674. end
  675. end
  676. end
  677. else
  678. if holding then
  679. holding = false
  680. mouse1release()
  681. end
  682.  
  683. mspoof = nil
  684. end
  685. else
  686. if holding then
  687. holding = false
  688. mouse1release()
  689. end
  690.  
  691. mspoof = nil
  692. end
  693. else
  694. if holding then
  695. holding = false
  696. mouse1release()
  697. end
  698.  
  699. mspoof = nil
  700. end
  701. end)
  702. end
  703.  
  704. self.InputConnection = Connect(UserInputService.InputBegan, function(key)
  705. if self.Enabled and self.AutoPeak.Enabled and key.UserInputType == Enum.UserInputType.MouseButton3 then
  706. local root = LocalPlayer.Character and FindFirstChild(LocalPlayer.Character, "HumanoidRootPart")
  707.  
  708. if root then
  709. self.AutoPeak.PointPosition = not self.AutoPeak.PointPosition and root.Position or nil
  710. end
  711. end
  712. end)
  713.  
  714. local Players2 = game.GetService(game, "Players");
  715. local Client2 = Players2.LocalPlayer;
  716. local Mouse2 = Client2.GetMouse(Client2);
  717.  
  718. local old; old = hookmetamethod(game, "__index", newcclosure(function(i,v)
  719. if string.lower(v) == "hit" then
  720. if old(i, "ClassName") == "Mouse" or old(i, "ClassName") == "PlayerMouse" then
  721. if not checkcaller() then
  722. if mspoof then
  723. return CFrame.new(mspoof)
  724. end
  725. end
  726. end
  727. end
  728. return old(i,v)
  729. end))
  730.  
  731. local old2; old2 = hookmetamethod(game, "__namecall", newcclosure(function(self2, ...)
  732. if getnamecallmethod() == "ViewportPointToRay" and not checkcaller() and mspoof then
  733. local args = {...}
  734. local pos = GetMouseLocation(UserInputService)
  735. if math.abs(args[1] - (pos.X + self.Offset.X)) <= 3 and math.abs(args[2] - (pos.Y + self.Offset.Y)) <= 3 then
  736. local newPos = workspace.CurrentCamera.WorldToViewportPoint(workspace.CurrentCamera, mspoof)
  737. args[1] = newPos.X
  738. args[2] = newPos.Y
  739. return old2(self2, table.unpack(args))
  740. else
  741. if math.abs(args[1] - (Mouse2.X + self.Offset.X)) <= 3 and math.abs(args[2] - (Mouse2.Y + self.Offset.Y)) <= 3 then
  742. local newPos = workspace.CurrentCamera.WorldToViewportPoint(workspace.CurrentCamera, mspoof)
  743. args[1] = newPos.X
  744. args[2] = newPos.Y
  745. return old2(self2, table.unpack(args))
  746. end
  747. end
  748. elseif getnamecallmethod() == "ScreenPointToRay" and not checkcaller() and mspoof then
  749. local args = {...}
  750. local pos = GetMouseLocation(UserInputService)
  751. if math.abs(args[1] - (pos.X + self.Offset.X)) <= 3 and math.abs(args[2] - (pos.Y + self.Offset.Y)) <= 3 then
  752. local newPos = workspace.CurrentCamera.WorldToScreenPoint(workspace.CurrentCamera, mspoof)
  753. args[1] = newPos.X
  754. args[2] = newPos.Y
  755. return old2(self2, table.unpack(args))
  756. else
  757. if math.abs(args[1] - (Mouse2.X + self.Offset.X)) <= 3 and math.abs(args[2] - (Mouse2.Y + self.Offset.Y)) <= 3 then
  758. local newPos = workspace.CurrentCamera.WorldToScreenPoint(workspace.CurrentCamera, mspoof)
  759. args[1] = newPos.X
  760. args[2] = newPos.Y
  761. return old2(self2, table.unpack(args))
  762. end
  763. end
  764. end
  765. return old2(self2, ...)
  766. end))
  767.  
  768. --[[
  769. local old2; old2 = hookmetamethod(game, "__namecall", function(self2, ...)
  770. local args = {...}
  771. if getnamecallmethod() == "ScreenPointToRay" or getnamecallmethod() == "ViewportPointToRay" and mspoof then
  772. local SecondPosition = game.GetService(game, "UserInputService").GetMouseLocation(game.GetService(game, "UserInputService"))
  773. if args[1] == Mouse2.X and args[2] == Mouse2.Y or args[1] == SecondPosition.X and args[2] == SecondPosition.Y then
  774. local newPos = workspace.CurrentCamera.WorldToScreenPoint(workspace.CurrentCamera, mspoof)
  775. args[1] = newPos.X
  776. args[2] = newPos.Y
  777. return old2(self2, table.unpack(args))
  778. end
  779. end
  780. return old2(self2, ...)
  781. end)
  782. --]]
  783. end
  784.  
  785. --//Completely kills aimbot, as opposed to enabled = false
  786. function Aimbot:Kill()
  787. self.Enabled = false
  788.  
  789. if self.RenderStep then
  790. Disconnect(self.RenderStep)
  791. self.RenderStep = nil
  792. end
  793.  
  794. if self.Heartbeat then
  795. Disconnect(self.Heartbeat)
  796. self.Heartbeat = nil
  797. end
  798.  
  799. if self.InputConnection then
  800. Disconnect(self.InputConnection)
  801. self.InputConnection = nil
  802. end
  803. end
  804.  
  805. --//Constructor
  806. function Aimbot.new(presets)
  807. presets = presets or {}
  808. UpdateTable(presets, Aimbot.DefaultSettings)
  809.  
  810. local WallCheckParams = RaycastParams.new()
  811. WallCheckParams.FilterType = Enum.RaycastFilterType.Blacklist
  812. WallCheckParams.IgnoreWater = presets.IgnoreWater
  813. WallCheckParams.FilterDescendantsInstances = presets.DefaultIgnore
  814.  
  815. presets.WallCheckParams = WallCheckParams
  816. return setmetatable(presets, Aimbot)
  817. end
  818.  
  819. --//Return with default settings
  820. return Aimbot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement