Advertisement
xennyYT

[FE] Universal Aimbot

Nov 21st, 2019
5,072
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.47 KB | None | 0 0
  1. --Made By bditt on V3rm not me
  2. local safe = setmetatable({}, {
  3. __index = function(_, k)
  4. return game:GetService(k)
  5. end
  6. })
  7.  
  8. local movethemouse = mousemoverel or Input.MoveMouse --Mouse Move Function.
  9. local leftclickme = nil --Auto Shoot Key Press Thingy.
  10. local aimbotting = true -- Toggles.
  11. local autoshoot = false
  12. local teamcheck = true
  13. local visiblecheck = true
  14. _G.xaimoffset = 0 --_G.xaimoffset = -25
  15. _G.maxdistfromcross = 100
  16.  
  17. local cam = safe.Workspace.CurrentCamera -- Current Camera
  18. local lp = safe.Players.LocalPlayer -- Local Player
  19. local lpc = safe.Players.LocalPlayer.Character -- Local Player Character
  20.  
  21. local wtos = function(v) -- World To Screen
  22. return cam:WorldToScreenPoint(v)
  23. end
  24.  
  25. local distFromCenter = function(x, y)
  26. local vps = cam.ViewportSize -- Get ViewPortSize.
  27. local vpsx = vps.X
  28. local vpsy = vps.Y
  29. local screencenterx = vpsx/2
  30. local screencentery = vpsy/2
  31. local xdist = (x - screencenterx) -- X Distance From Mid Screen.
  32. local ydist = (y - screencentery) -- Y Distance From Mid Screen.
  33. local Hypotenuse = math.sqrt(math.pow(xdist, 2) + math.pow(ydist, 2))
  34. return Hypotenuse
  35. end
  36.  
  37. local function inlos(p, ...) -- In line of site?
  38. return #cam:GetPartsObscuringTarget({p}, {cam, lp.Character, ...}) == 0
  39. end
  40.  
  41. local getclosestPlayer = function() -- Checks the closest player based on Hypotenuse.
  42. local plrs, v = safe.Players:GetPlayers()
  43. local maxdist = 75
  44. local dist = math.huge
  45. local plr = "none"
  46. for i = 1, #plrs do
  47. v = plrs[i]
  48. if v ~= safe.Players.LocalPlayer then
  49. if v.Character then
  50. if v.TeamColor ~= safe.Players.LocalPlayer.TeamColor and teamcheck then
  51. local hpos = wtos(v.Character.Head.Position)
  52. local idist = distFromCenter(hpos.X, hpos.Y)
  53. if idist < dist and idist < _G.maxdistfromcross then
  54. dist = idist
  55. plr = v
  56. end
  57. elseif not teamcheck then
  58. local hpos = wtos(v.Character.Head.Position)
  59. local idist = distFromCenter(hpos.X, hpos.Y)
  60. if idist < dist and idist < _G.maxdistfromcross then
  61. dist = idist
  62. plr = v
  63. end
  64. end
  65. end
  66. end
  67. end
  68. return plr, dist
  69. end
  70.  
  71. local AimAt = function(x, y)
  72. local vps = cam.ViewportSize
  73. local vpsx = vps.X
  74. local vpsy = vps.Y
  75. local screencenterx = vpsx/2
  76. local screencentery = vpsy/2
  77. local aimspeed = 5
  78. local aimatx
  79. local aimaty
  80.  
  81. if x ~= 0 then
  82. if x > screencenterx then
  83. aimatx = -(screencenterx - x)
  84. aimatx = aimatx/aimspeed
  85. if aimatx + screencenterx > screencenterx * 2 then
  86. aimatx = 0
  87. end
  88. end
  89. if x < screencenterx then
  90. aimatx = x - screencenterx
  91. aimatx = aimatx/aimspeed
  92. if aimatx + screencenterx < 0 then
  93. aimatx = 0
  94. end
  95. end
  96. end
  97.  
  98. if y ~= 0 then
  99. if y > screencentery then
  100. aimaty = -(screencentery - y)
  101. aimaty = aimaty/aimspeed
  102. if aimaty + screencentery > screencentery * 2 then
  103. aimaty = 0
  104. end
  105. end
  106. if y < screencentery then
  107. aimaty = y - screencentery
  108. aimaty = aimaty/aimspeed
  109. if aimaty + screencentery < 0 then
  110. aimaty = 0
  111. end
  112. end
  113. end
  114. return aimatx, aimaty
  115. end
  116.  
  117. local MouseTests = function()
  118. local player = safe.Players.LocalPlayer
  119. local mouse = player:GetMouse()
  120. local screensizex = mouse.ViewSizeX
  121. local screensizey = mouse.ViewSizeY
  122. local midx = screensizex/2
  123. local midy = screensizey/2
  124. local mousex = mouse.X
  125. local mousey = mouse.Y
  126. local moveamountx = midx - mousex
  127. local moveamounty = midy - mousey
  128. movethemouse(moveamountx, moveamounty)
  129. local camera = safe.Workspace.Camera
  130. local newmousex = safe.Players.LocalPlayer:GetMouse().X
  131. local newmousey = safe.Players.LocalPlayer:GetMouse().Y
  132. local closestplayer = getclosestPlayer()
  133. if player.Character.Humanoid.Health > 0 then
  134. if closestplayer ~= "none" then
  135. if inlos(closestplayer.Character.Head.Position, closestplayer.Character) and visiblecheck then
  136. local closesthead = closestplayer.Character.Head
  137. local p = camera:WorldToScreenPoint(closesthead.Position)
  138. local xdistancetohead, ydistancetohead = AimAt(p.X + _G.xaimoffset, p.Y + 32)
  139. movethemouse(xdistancetohead, ydistancetohead)
  140. if autoshoot then
  141. movethemouse(xdistancetohead, ydistancetohead)
  142. wait(1)
  143. Input.LeftClick(MOUSE_DOWN)
  144. wait()
  145. end
  146. elseif not visiblecheck then
  147. local closesthead = closestplayer.Character.Head
  148. local p = camera:WorldToScreenPoint(closesthead.Position)
  149. local xdistancetohead, ydistancetohead = AimAt(p.X + _G.xaimoffset, p.Y + 32)
  150. movethemouse(xdistancetohead, ydistancetohead)
  151. end
  152. end
  153. end
  154. end
  155.  
  156. game:GetService('RunService').Stepped:connect(function()
  157. if aimbotting then
  158. --MouseTests()
  159. end
  160. end)
  161.  
  162.  
  163. local plr = safe.Players.LocalPlayer
  164. local mouse = plr:GetMouse()
  165. mouse.KeyDown:connect(function(key)
  166. if key == "t" then
  167. aimbotting = not aimbotting
  168. print("Aimbotting: " .. tostring(aimbotting))
  169. MouseTests()
  170. end
  171. if key == "o" then
  172. visiblecheck = not visiblecheck
  173. print("Visible Check: " .. tostring(visiblecheck))
  174. end
  175.  
  176. if key == "m" then
  177. teamcheck = not teamcheck
  178. print("Team Check: " .. tostring(teamcheck))
  179. end
  180. end)
  181.  
  182.  
  183.  
  184. print("Pixel Aimbot Loaded!")
  185.  
  186. MB2Held = false
  187.  
  188. function onKeyPress(inputObject,gameProcessed)
  189. if inputObject.UserInputType == Enum.UserInputType.MouseButton2 then
  190. MB2Held = true
  191. while MB2Held do
  192. if aimbotting then
  193. MouseTests()
  194. end
  195. wait()
  196. end
  197. end
  198. end
  199.  
  200. function onKeyRelease(inputObject,gameProcessed)
  201. if inputObject.UserInputType == Enum.UserInputType.MouseButton2 then
  202. MB2Held = false
  203. end
  204. end
  205.  
  206. game:GetService("UserInputService").InputBegan:connect(onKeyPress)
  207. game:GetService("UserInputService").InputEnded:connect(onKeyRelease)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement