Advertisement
Stacksity

Phantom Forces Aimbot

Apr 25th, 2019
1,184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.31 KB | None | 0 0
  1. local safe = setmetatable({}, { __index = function(_, k)
  2. return game:GetService(k)
  3. end
  4. })
  5.  
  6. local movethemouse = mousemoverel or Input.MoveMouse --Mouse Move Function.
  7. local leftclickme = nil --Auto Shoot Key Press Thingy.
  8. local aimbotting = true -- Toggles.
  9. local autoshoot = false
  10. local teamcheck = true
  11. local visiblecheck = true
  12. _G.xaimoffset = 0 --_G.xaimoffset = -25
  13. _G.maxdistfromcross = 100
  14.  
  15. local cam = safe.Workspace.CurrentCamera -- Current Camera
  16. local lp = safe.Players.LocalPlayer -- Local Player
  17. local lpc = safe.Players.LocalPlayer.Character -- Local Player Character
  18.  
  19. local wtos = function(v) -- World To Screen
  20. return cam:WorldToScreenPoint(v)
  21. end
  22.  
  23. local distFromCenter = function(x, y)
  24. local vps = cam.ViewportSize -- Get ViewPortSize.
  25. local vpsx = vps.X
  26. local vpsy = vps.Y
  27. local screencenterx = vpsx/2
  28. local screencentery = vpsy/2
  29. local xdist = (x - screencenterx) -- X Distance From Mid Screen.
  30. local ydist = (y - screencentery) -- Y Distance From Mid Screen.
  31. local Hypotenuse = math.sqrt(math.pow(xdist, 2) + math.pow(ydist, 2))
  32. return Hypotenuse
  33. end
  34.  
  35. local function inlos(p, ...) -- In line of site?
  36. return #cam:GetPartsObscuringTarget({p}, {cam, lp.Character, ...}) == 0
  37. end
  38.  
  39. local getclosestPlayer = function() -- Checks the closest player based on Hypotenuse.
  40. local plrs, v = safe.Players:GetPlayers()
  41. local maxdist = 75
  42. local dist = math.huge
  43. local plr = "none"
  44. for i = 1, #plrs do
  45. v = plrs[i]
  46. if v ~= safe.Players.LocalPlayer then
  47. if v.Character then
  48. if v.TeamColor ~= safe.Players.LocalPlayer.TeamColor and teamcheck then
  49. local hpos = wtos(v.Character.Head.Position)
  50. local idist = distFromCenter(hpos.X, hpos.Y)
  51. if idist < dist and idist < _G.maxdistfromcross then
  52. dist = idist
  53. plr = v
  54. end
  55. elseif not teamcheck then
  56. local hpos = wtos(v.Character.Head.Position)
  57. local idist = distFromCenter(hpos.X, hpos.Y)
  58. if idist < dist and idist < _G.maxdistfromcross then
  59. dist = idist
  60. plr = v
  61. end
  62. end
  63. end
  64. end
  65. end
  66. return plr, dist
  67. end
  68.  
  69. local AimAt = function(x, y)
  70. local vps = cam.ViewportSize
  71. local vpsx = vps.X
  72. local vpsy = vps.Y
  73. local screencenterx = vpsx/2
  74. local screencentery = vpsy/2
  75. local aimspeed = 5
  76. local aimatx
  77. local aimaty
  78.  
  79. if x ~= 0 then
  80. if x > screencenterx then
  81. aimatx = -(screencenterx - x)
  82. aimatx = aimatx/aimspeed
  83. if aimatx + screencenterx > screencenterx * 2 then
  84. aimatx = 0
  85. end
  86. end
  87. if x < screencenterx then
  88. aimatx = x - screencenterx
  89. aimatx = aimatx/aimspeed
  90. if aimatx + screencenterx < 0 then
  91. aimatx = 0
  92. end
  93. end
  94. end
  95.  
  96. if y ~= 0 then
  97. if y > screencentery then
  98. aimaty = -(screencentery - y)
  99. aimaty = aimaty/aimspeed
  100. if aimaty + screencentery > screencentery * 2 then
  101. aimaty = 0
  102. end
  103. end
  104. if y < screencentery then
  105. aimaty = y - screencentery
  106. aimaty = aimaty/aimspeed
  107. if aimaty + screencentery < 0 then
  108. aimaty = 0
  109. end
  110. end
  111. end
  112. return aimatx, aimaty
  113. end
  114.  
  115. local MouseTests = function()
  116. local player = safe.Players.LocalPlayer
  117. local mouse = player:GetMouse()
  118. local screensizex = mouse.ViewSizeX
  119. local screensizey = mouse.ViewSizeY
  120. local midx = screensizex/2
  121. local midy = screensizey/2
  122. local mousex = mouse.X
  123. local mousey = mouse.Y
  124. local moveamountx = midx - mousex
  125. local moveamounty = midy - mousey
  126. movethemouse(moveamountx, moveamounty)
  127. local camera = safe.Workspace.Camera
  128. local newmousex = safe.Players.LocalPlayer:GetMouse().X
  129. local newmousey = safe.Players.LocalPlayer:GetMouse().Y
  130. local closestplayer = getclosestPlayer()
  131. if player.Character.Humanoid.Health > 0 then
  132. if closestplayer ~= "none" then
  133. if inlos(closestplayer.Character.Head.Position, closestplayer.Character) and visiblecheck then
  134. local closesthead = closestplayer.Character.Head
  135. local p = camera:WorldToScreenPoint(closesthead.Position)
  136. local xdistancetohead, ydistancetohead = AimAt(p.X + _G.xaimoffset, p.Y + 32)
  137. movethemouse(xdistancetohead, ydistancetohead)
  138. if autoshoot then
  139. movethemouse(xdistancetohead, ydistancetohead)
  140. wait(1)
  141. Input.LeftClick(MOUSE_DOWN)
  142. wait()
  143. end
  144. elseif not visiblecheck then
  145. local closesthead = closestplayer.Character.Head
  146. local p = camera:WorldToScreenPoint(closesthead.Position)
  147. local xdistancetohead, ydistancetohead = AimAt(p.X + _G.xaimoffset, p.Y + 32)
  148. movethemouse(xdistancetohead, ydistancetohead)
  149. end
  150. end
  151. end
  152. end
  153.  
  154. game:GetService('RunService').Stepped:connect(function()
  155. if aimbotting then
  156. --MouseTests()
  157. end
  158. end)
  159.  
  160.  
  161. local plr = safe.Players.LocalPlayer
  162. local mouse = plr:GetMouse()
  163. mouse.KeyDown:connect(function(key)
  164. if key == "t" then
  165. aimbotting = not aimbotting
  166. print("Aimbotting: " .. tostring(aimbotting))
  167. MouseTests()
  168. end
  169. if key == "o" then
  170. visiblecheck = not visiblecheck
  171. print("Visible Check: " .. tostring(visiblecheck))
  172. end
  173.  
  174. if key == "m" then
  175. teamcheck = not teamcheck
  176. print("Team Check: " .. tostring(teamcheck))
  177. end
  178. end)
  179.  
  180.  
  181.  
  182. print("Pixel Aimbot Loaded!")
  183.  
  184. MB2Held = false
  185.  
  186. function onKeyPress(inputObject,gameProcessed)
  187. if inputObject.UserInputType == Enum.UserInputType.MouseButton2 then
  188. MB2Held = true
  189. while MB2Held do
  190. if aimbotting then
  191. MouseTests()
  192. end
  193. wait()
  194. end
  195. end
  196. end
  197.  
  198. function onKeyRelease(inputObject,gameProcessed)
  199. if inputObject.UserInputType == Enum.UserInputType.MouseButton2 then
  200. MB2Held = false
  201. end
  202. end
  203.  
  204. game:GetService("UserInputService").InputBegan:connect(onKeyPress)
  205. game:GetService("UserInputService").InputEnded:connect(onKeyRelease)
  206.  
  207. trans = 0.5
  208. --team1 = BackgroundColor3.new("Institutional white")
  209. --team2 = BackgroundColor3.new("Really red")
  210.  
  211. while true do
  212. for i,l in pairs(game:GetService("Players"):GetChildren()) do
  213. print (game:GetService("Players").LocalPlayer.Team)
  214. if l ~= game:GetService("Players").LocalPlayer then
  215. for i,v in pairs(l.Character:GetChildren()) do
  216. if v.ClassName == "MeshPart" or "Part" and v.Name ~= "HumanoidRootPart" then
  217. --
  218. xd = Instance.new("SurfaceGui")
  219. xd.Face = Enum.NormalId.Back
  220. xd.Parent = v
  221. xd.AlwaysOnTop = true
  222. Frame = Instance.new("Frame")
  223. Frame.Parent = xd
  224. Frame.BackgroundColor3 = Color3.new(1, 1, 1)
  225. Frame.Size = UDim2.new(1, 0, 1, 0)
  226. Frame.BackgroundTransparency = trans
  227.  
  228. if l.Team ~= game:GetService("Players").LocalPlayer.Team then
  229. Frame.BackgroundColor3 = Color3.new(17,17 ,17)
  230. else Frame.BackgroundColor3 = Color3.new(0, 255, 255)
  231.  
  232. end
  233.  
  234. --
  235.  
  236. xd = Instance.new("SurfaceGui")
  237. xd.Face = Enum.NormalId.Bottom
  238. xd.Parent = v
  239. xd.AlwaysOnTop = true
  240. Frame = Instance.new("Frame")
  241. Frame.Parent = xd
  242. Frame.BackgroundColor3 = Color3.new(1, 1, 1)
  243. Frame.Size = UDim2.new(1, 0, 1, 0)
  244. Frame.BackgroundTransparency = trans
  245.  
  246. if l.Team ~= game:GetService("Players").LocalPlayer.Team then
  247. Frame.BackgroundColor3 = Color3.new(17,17 ,17)
  248. else Frame.BackgroundColor3 = Color3.new(0, 255, 255)
  249.  
  250. end
  251.  
  252. --
  253.  
  254. xd = Instance.new("SurfaceGui")
  255. xd.Face = Enum.NormalId.Front
  256. xd.Parent = v
  257. xd.AlwaysOnTop = true
  258. Frame = Instance.new("Frame")
  259. Frame.Parent = xd
  260. Frame.BackgroundColor3 = Color3.new(1, 1, 1)
  261. Frame.Size = UDim2.new(1, 0, 1, 0)
  262. Frame.BackgroundTransparency = trans
  263.  
  264. if l.Team ~= game:GetService("Players").LocalPlayer.Team then
  265. Frame.BackgroundColor3 = Color3.new(17,17 ,17)
  266. else Frame.BackgroundColor3 = Color3.new(0, 255, 255)
  267.  
  268. end
  269.  
  270.  
  271. --
  272.  
  273. xd = Instance.new("SurfaceGui")
  274. xd.Face = Enum.NormalId.Left
  275. xd.Parent = v
  276. xd.AlwaysOnTop = true
  277. Frame = Instance.new("Frame")
  278. Frame.Parent = xd
  279. Frame.BackgroundColor3 = Color3.new(1, 1, 1)
  280. Frame.Size = UDim2.new(1, 0, 1, 0)
  281. Frame.BackgroundTransparency = trans
  282.  
  283. if l.Team ~= game:GetService("Players").LocalPlayer.Team then
  284. Frame.BackgroundColor3 = Color3.new(17,17 ,17)
  285. else Frame.BackgroundColor3 = Color3.new(0, 255, 255)
  286.  
  287. end
  288. --
  289.  
  290. xd = Instance.new("SurfaceGui")
  291. xd.Face = Enum.NormalId.Right
  292. xd.Parent = v
  293. xd.AlwaysOnTop = true
  294. Frame = Instance.new("Frame")
  295. Frame.Parent = xd
  296. Frame.BackgroundColor3 = Color3.new(1, 1, 1)
  297. Frame.Size = UDim2.new(1, 0, 1, 0)
  298. Frame.BackgroundTransparency = trans
  299.  
  300. if l.Team ~= game:GetService("Players").LocalPlayer.Team then
  301. Frame.BackgroundColor3 = Color3.new(17,17 ,17)
  302. else Frame.BackgroundColor3 = Color3.new(0, 255, 255)
  303.  
  304. end
  305. --
  306.  
  307. xd = Instance.new("SurfaceGui")
  308. xd.Face = Enum.NormalId.Top
  309. xd.Parent = v
  310. xd.AlwaysOnTop = true
  311. Frame = Instance.new("Frame")
  312. Frame.Parent = xd
  313. Frame.BackgroundColor3 = Color3.new(1, 1, 1)
  314. Frame.Size = UDim2.new(1, 0, 1, 0)
  315. Frame.BackgroundTransparency = trans
  316.  
  317.  
  318. if l.Team ~= game:GetService("Players").LocalPlayer.Team then
  319. Frame.BackgroundColor3 = Color3.new(17,17 ,17)
  320. else Frame.BackgroundColor3 = Color3.new(0, 255, 255)
  321.  
  322. end
  323.  
  324.  
  325. print (v.Name)
  326.  
  327. end
  328. end
  329. end
  330. end
  331.  
  332. wait (5)
  333. for i,v in pairs (game:GetService("Players"):GetChildren()) do
  334. for i,k in pairs(v.Character:GetChildren()) do
  335. for i,l in pairs(k:GetChildren()) do
  336. if l.ClassName == "SurfaceGui" then
  337. l:Remove()
  338. end
  339. end
  340. end
  341. end
  342.  
  343. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement