Advertisement
AlbertsHere

Phantom Forces Aimbot Script Working 2019

Feb 20th, 2019
58,786
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Phantom Forces Aimbot
  2.  
  3.  
  4. local Mortadex = {}
  5. Mortadex.Version = "1"
  6. Mortadex.Modules = {}
  7. Mortadex.ModuleCount = 0
  8. Mortadex.ModuleSelection = 1
  9.  
  10. Mortadex.Stealth = true -- this will just remove print messages
  11. Mortadex.Debug = false
  12. Mortadex.FreeForAll = false
  13. Mortadex.Studio = false
  14.  
  15. function Mortadex:RegisterModule(name, onrender, norender)
  16. if Mortadex.Modules[name] then
  17. return error("Module \""..name.."\" already registered!")
  18. else
  19. Mortadex:FLog("Registering module \"%s\"", name)
  20. Mortadex.Modules[name] = {OnRender = onrender, NoRender = norender, Scratchpad = {}, Enabled = false, Order = Mortadex.ModuleCount}
  21. Mortadex.ModuleCount = Mortadex.ModuleCount + 1
  22. end
  23. end
  24.  
  25. function Mortadex:Log(...)
  26. if Mortadex.Stealth then return end
  27. return print("[- MORTADEX -] ", ...)
  28. end
  29.  
  30. function Mortadex:FLog(o, ...)
  31. return Mortadex:Log(o:format(...))
  32. end
  33.  
  34. local getrawmetatable = getrawmetatable
  35.  
  36. ---------------------------------------------------------------
  37.  
  38. Mortadex:Log("Loading core utilities...")
  39.  
  40. Mortadex.HookManager = {IdxHooks = {}, NIdxHooks = {}}
  41. Mortadex.Utilities = {}
  42. Mortadex.Services = {
  43. Players = game:GetService("Players"),
  44. Lighting = game:GetService("Lighting"),
  45. RunService = game:GetService("RunService"),
  46. UserInputService = game:GetService("UserInputService")
  47. }
  48. Mortadex.Instances = {
  49. LocalPlayer = Mortadex.Services.Players.LocalPlayer,
  50. LocalCharacter = Mortadex.Services.Players.LocalPlayer.Character,
  51. LocalCamera = workspace.CurrentCamera,
  52. LocalMouse = Mortadex.Services.Players.LocalPlayer:GetMouse()
  53. }
  54.  
  55. function Mortadex.HookManager:Init()
  56. if getrawmetatable then
  57. local ObjectMt = getrawmetatable(game)
  58. Mortadex.OriginalIndex = ObjectMt.__index
  59. Mortadex.OriginalNewIndex = ObjectMt.__newindex
  60.  
  61. ObjectMt.__index = function(self, key)
  62. local Hook = Mortadex.HookManager:LookupIndexHook(self, key)
  63. if Hook then
  64. return Hook(self)
  65. else
  66. return Mortadex.OriginalIndex(self, key)
  67. end
  68. end
  69.  
  70. ObjectMt.__newindex = function(self, key, value)
  71. local Hook = Mortadex.HookManager:LookupNewIndexHook(self, key)
  72. if Hook then
  73. return Hook(self, value)
  74. else
  75. return Mortadex.OriginalNewIndex(self, key, value)
  76. end
  77. end
  78.  
  79. return true
  80. end
  81. end
  82.  
  83. function Mortadex.HookManager:LookupIndexHook(inst, key)
  84. for _, Hook in next, Mortadex.HookManager.IdxHooks do
  85. if Mortadex.OriginalIndex(inst, "IsA")(inst, Hook.AffectedClass) and Hook.Property == key then
  86. return Hook.HookFunction
  87. end
  88. end
  89. end
  90.  
  91. function Mortadex.HookManager:LookupNewIndexHook(inst, key)
  92. for _, Hook in next, Mortadex.HookManager.NIdxHooks do
  93. if Mortadex.OriginalIndex(inst, "IsA")(inst, Hook.AffectedClass) and Hook.Property == key then
  94. return Hook.HookFunction
  95. end
  96. end
  97. end
  98.  
  99. function Mortadex.HookManager:HookIndex(class, prop, f)
  100. return table.insert(Mortadex.HookManager.IdxHooks, {AffectedClass = class, Property = prop, HookFunction = f})
  101. end
  102.  
  103. function Mortadex.HookManager:HookNewIndex(class, prop, f)
  104. return table.insert(Mortadex.HookManager.NIdxHooks, {AffectedClass = class, Property = prop, HookFunction = f})
  105. end
  106.  
  107. function Mortadex.Utilities:WorldToScreenPoint(...)
  108. return Mortadex.Instances.LocalCamera:WorldToScreenPoint(...)
  109. end
  110.  
  111. function Mortadex.Utilities:PathObstructed(p1, p2, ...)
  112. local ray = Ray.new(p1, (p2 - p1).unit * 500)
  113. local haspart, hitpos = workspace:FindPartOnRayWithIgnoreList(ray, {...})
  114. if haspart then return true, hitpos else return false end
  115. end
  116.  
  117. function Mortadex.Utilities:GetReplicator()
  118. return game:FindFirstChild("ClientReplicator", true)
  119. end
  120.  
  121. function Mortadex.Utilities:GetSize(i)
  122. if i:IsA("BasePart") then
  123. return i.Size
  124. elseif i:IsA("Model") then
  125. return i:GetExtentsSize()
  126. end
  127. end
  128.  
  129. function Mortadex.Utilities:GetPlayers(mode)
  130. local Result = {}
  131. for _,player in next, Mortadex.Services.Players:GetPlayers() do
  132. if mode == 0 then -- exclude players in current team
  133. if (player ~= Mortadex.Instances.LocalPlayer and (Mortadex.Instances.LocalPlayer.TeamColor ~= player.TeamColor or (FreeForAll or DEBUG))) then
  134. table.insert(Result, player)
  135. end
  136. else -- include everyone
  137. table.insert(Result, player)
  138. end
  139. end
  140. return Result
  141. end
  142.  
  143. function Mortadex.Utilities:GetNearestPlayer()
  144. if not Mortadex.Instances.LocalPlayer.Character then return end
  145. local Players = Mortadex.Utilities:GetPlayers(0)
  146. local SelectedPlayer, SelectedPlayerPrevDistance = nil, 25000
  147. for i,v in next, Players do
  148. if v.Character and v.Character:FindFirstChild("HumanoidRootPart") then
  149. local Distance = Mortadex.Utilities:GetDistance(Mortadex.Instances.LocalPlayer.Character.HumanoidRootPart.Position, v.Character.HumanoidRootPart.Position)
  150. if Distance < SelectedPlayerPrevDistance then
  151. SelectedPlayer = v
  152. SelectedPlayerPrevDistance = Distance
  153. end
  154. end
  155. end
  156. return SelectedPlayer
  157. end
  158.  
  159. function Mortadex.Utilities:GetDistance(v1, v2)
  160. return (v1 - v2).magnitude
  161. end
  162.  
  163. function Mortadex.Utilities:GetCanvas()
  164. if not Mortadex.Canvas then
  165. if getrawmetatable then
  166. Mortadex.Canvas = Instance.new("ScreenGui", game:GetService("CoreGui"))
  167. else
  168. Mortadex.Canvas = Instance.new("ScreenGui", Mortadex.Services.Players.LocalPlayer.PlayerGui)
  169. end
  170. end
  171. return Mortadex.Canvas
  172. end
  173.  
  174. Mortadex.EmptyVector3 = Vector3.new()
  175. Mortadex.EmptyCFrame = CFrame.new()
  176.  
  177. ---------------------------------------------------------------
  178.  
  179. --> ESP
  180. Mortadex:RegisterModule("ESP", function(Storage)
  181. local Canvas = Mortadex.Utilities:GetCanvas()
  182. local Root = Canvas:FindFirstChild("ESP")
  183. if not Root then
  184. Root = Instance.new("Frame")
  185. Root.Name = "ESP"
  186. Root.Size = UDim2.new(1, 0, 1, 0)
  187. Root.BackgroundTransparency = 1
  188. end
  189.  
  190. Root:ClearAllChildren()
  191. for _, Player in next, Mortadex.Utilities:GetPlayers(0) do
  192. if Player.Character and Player.Character:FindFirstChild("Torso") then
  193. local Locator = Instance.new("Frame")
  194. Locator.BackgroundColor = Player.TeamColor
  195. Locator.BackgroundTransparency = .5
  196. local VPos, VVis = Mortadex.Utilities:WorldToScreenPoint(Player.Character.Torso.Position)
  197. if VVis then
  198. Locator.Size = UDim2.new(0, -2800 / VPos.z, 0, -4300 / VPos.z)
  199. Locator.Position = UDim2.new(0, VPos.x - Locator.Size.X.Offset / 2, 0, VPos.y - Locator.Size.Y.Offset / 2)
  200. local Name = Instance.new("TextLabel")
  201. Name.TextColor3 = Color3.new(1,1,1)
  202. Name.Size = UDim2.new(1,0,0, Locator.Size.Y.Offset / 5)
  203. Name.BackgroundTransparency = 1
  204. Name.TextScaled = true
  205. Name.FontSize = 'Size24'
  206. Name.Text = Player.Name
  207. Name.TextStrokeTransparency = .3
  208. Name.Font = 'SourceSansLight'
  209. Name.TextXAlignment = 'Left'
  210. Name.Parent = Locator
  211. Locator.Parent = Root
  212. else
  213. Locator:Destroy()
  214. end
  215. end
  216. end
  217.  
  218. if not Root.Parent then
  219. Root.Parent = Canvas
  220. end
  221. end)
  222.  
  223. --> FreeForAll
  224. Mortadex:RegisterModule("FreeForAll", function(Storage)
  225. FreeForAll = true
  226. end, function(Storage) FreeForAll = false end)
  227.  
  228. --> Chams
  229. Mortadex:RegisterModule("Chams", function(Storage)
  230. for i, Cham in next, Storage do
  231. if Cham.Name:find("Cham") then
  232. Cham:Destroy()
  233. Storage[i] = nil
  234. end
  235. end
  236.  
  237. for _, Player in next, Mortadex.Utilities:GetPlayers(0) do
  238. if Player.Character and Player.Character:FindFirstChild("Torso") then
  239. for _, Part in next, Player.Character:GetChildren() do
  240. if Part:IsA("PVInstance") then
  241. local Box = Instance.new("BoxHandleAdornment")
  242. Box.Size = Mortadex.Utilities:GetSize(Part) + Vector3.new(.2, .2, .2)
  243. Box.Name = "Cham" .. Player.Name
  244. Box.Color3 = Player.TeamColor.Color
  245. Box.Adornee = Part
  246. Box.AlwaysOnTop = true
  247. Box.ZIndex = 5
  248. Box.Transparency = .1
  249. table.insert(Storage, Box)
  250. Box.Parent = Mortadex.Utilities:GetCanvas()
  251. end
  252. end
  253. end
  254. end
  255. end)
  256.  
  257. --> LagSwitch
  258. Mortadex:RegisterModule("LagSwitch", function(Storage)
  259. if not Storage.State then
  260. Storage.State = true
  261. local Replicator = Mortadex.Utilities:GetReplicator()
  262. if Replicator then
  263. Replicator:DisableProcessPackets()
  264. end
  265. end
  266. end,
  267.  
  268. function(Storage)
  269. if Storage.State then
  270. Storage.State = false
  271. local Replicator = Mortadex.Utilities:GetReplicator()
  272. if Replicator then
  273. Replicator:EnableProcessPackets()
  274. end
  275. end
  276. end)
  277.  
  278. --> IronSight
  279. Mortadex:RegisterModule("IronSight", function(Storage)
  280. local Sight = Instance.new("Frame")
  281. Sight.Size = UDim2.new(0, 5, 0, 5)
  282. Sight.BackgroundTransparency = .5
  283. Sight.BackgroundColor3 = Color3.new(1, 1, 1)
  284. Sight.Position = UDim2.new(0, Mortadex.Instances.LocalMouse.X, 0, Mortadex.Instances.LocalMouse.Y)
  285. Sight.Parent = Mortadex.Utilities:GetCanvas()
  286. end)
  287.  
  288. --> KnifeMaster
  289. Mortadex:RegisterModule("KnifeMaster", function(Storage)
  290. if not Mortadex.Instances.LocalPlayer.Character then
  291. return
  292. end
  293. local Pl = Mortadex.Utilities:GetNearestPlayer()
  294. if Pl and Pl.Character and Mortadex.Utilities:GetDistance(Pl.Character.Torso.Position, Mortadex.Instances.LocalPlayer.Character.HumanoidRootPart.Position) < 150 then
  295. Mortadex.Instances.LocalPlayer.Character.HumanoidRootPart.CFrame = Pl.Character.Torso.CFrame * CFrame.new(0,0,3)
  296. end
  297. end)
  298.  
  299. --> BigHead
  300. Mortadex:RegisterModule("BigHead", function(Storage)
  301. for _, v in next, Mortadex.Utilities:GetPlayers(0) do
  302. if v.Character then
  303. if not Storage[v.Name] then
  304. Storage[v.Name] = { v.Character.Head.Size, v.Character.Head.CFrame }
  305. end
  306. v.Character.Head.CanCollide = false
  307. v.Character.Head.Size = Vector3.new(40, 40, 40)
  308. v.Character.Head.CFrame = v.Character.Torso.CFrame * CFrame.new(0, 20, 0)
  309. v.Character.Head.Transparency = .3
  310. end
  311. end
  312. end,
  313.  
  314. function(Storage)
  315. if not Storage.NormalSize then
  316. Storage.NormalSize = Vector3.new(2, 1, 1)
  317. end
  318.  
  319. for _, v in next, Mortadex.Utilities:GetPlayers(0) do
  320. if v.Character then
  321. v.Character.Head.CanCollide = true
  322. v.Character.Head.Size = Storage.NormalSize
  323. end
  324. end
  325. end)
  326.  
  327. ---------------------------------------------------------------
  328.  
  329. Mortadex:Log("Loading UI...")
  330.  
  331. function Mortadex:CreateWindow(name, size, timed_close, tween)
  332. local TopBar = Instance.new("TextLabel")
  333. TopBar.Name = "NO_CLEAR"
  334. TopBar.Size = UDim2.new(size.X.Scale, size.X.Offset, 0, 20)
  335. TopBar.BorderSizePixel = 0
  336. TopBar.BackgroundColor3 = Color3.new(1, 0, 0)
  337. TopBar.Text = name
  338. TopBar.TextXAlignment = Enum.TextXAlignment.Left
  339. TopBar.TextScaled = true
  340. TopBar.Font = Enum.Font.Code
  341. TopBar.TextColor3 = Color3.new(0, 0, 0)
  342. TopBar.Position = UDim2.new(.5, -(size.X.Offset/2), .5, -(size.Y.Offset/2))
  343. TopBar.Draggable = true
  344. TopBar.Active = true
  345.  
  346. local Window = Instance.new("Frame")
  347. Window.Name = "Content"
  348. Window.Size = size
  349. Window.BackgroundColor3 = Color3.new(0, 0, 0)
  350. Window.Position = UDim2.new(0, 0, 0, 20)
  351. Window.BackgroundTransparency = .3
  352. Window.BorderSizePixel = 0
  353.  
  354. if not timed_close then
  355. local CloseBtn = Instance.new("TextButton", TopBar)
  356. CloseBtn.Position = UDim2.new(1, -20, 0, 0)
  357. CloseBtn.Size = UDim2.new(0, 20, 1, 0)
  358. CloseBtn.BorderSizePixel = 0
  359. CloseBtn.Name = "CloseBtn"
  360. CloseBtn.BackgroundColor3 = Color3.new(0,0,0)
  361. CloseBtn.TextColor3 = Color3.new(1, 0, 0)
  362. CloseBtn.Text = "X"
  363. CloseBtn.MouseButton1Click:connect(function()
  364. TopBar:Destroy()
  365. end)
  366. else
  367. local Countdown = Instance.new("TextLabel", TopBar)
  368. Countdown.Position = UDim2.new(1, -20, 0, 0)
  369. Countdown.Size = UDim2.new(0, 20, 1, 0)
  370. Countdown.BackgroundTransparency = 1
  371. Countdown.TextColor3 = Color3.new(0, 0, 0)
  372. Countdown.Text = tostring(timed_close)
  373. local BackPos
  374. if tween then
  375. BackPos = TopBar.Position
  376. TopBar.Position = UDim2.new(.5, -(size.X.Offset/2), 1, 0)
  377. end
  378. spawn(function()
  379. if tween then
  380. TopBar:TweenPosition(BackPos, "Out", "Quad", .3, true)
  381. end
  382. for i = timed_close-1, 0, -1 do
  383. wait(1)
  384. Countdown.Text = tostring(i)
  385. end
  386. if not tween then
  387. TopBar:Destroy()
  388. else
  389. TopBar:TweenPosition(UDim2.new(.5, -(size.X.Offset/2), 1, 0), "Out", "Sine", .3, true)
  390. wait(.3)
  391. TopBar:Destroy()
  392. end
  393. end)
  394. end
  395.  
  396. Window.Parent = TopBar
  397. TopBar.Parent = Mortadex.Utilities:GetCanvas()
  398. return TopBar
  399. end
  400.  
  401.  
  402. ---------------------------------------------------------------
  403.  
  404. if not script then script = Instance.new("LocalScript") end
  405. Mortadex.UpvalScript = script
  406.  
  407. Mortadex:Log("Hooking functions...")
  408. Mortadex.HookManager:Init()
  409. Mortadex.HookManager:HookIndex("Player", "Kick", error)
  410. Mortadex.HookManager:HookIndex("BasePart", "Size", function(Part)
  411. local caller_env = getfenv(1)
  412. if caller_env.script ~= Mortadex.UpvalScript and caller_env.script.ClassName ~= "CoreScript" then
  413. if Part.Name == "Head" then
  414. return Mortadex.EmptyVector3
  415. end
  416. end
  417. return Mortadex.OriginalIndex(Part, "Size")
  418. end)
  419.  
  420. Mortadex.HookManager:HookIndex("BasePart", "CFrame", function(Part)
  421. local caller_env = getfenv(1)
  422. if caller_env.script ~= Mortadex.UpvalScript and caller_env.script.ClassName ~= "CoreScript" then
  423. if Part.Name == "Head" then
  424. return Mortadex.EmptyCFrame
  425. end
  426. end
  427. return Mortadex.OriginalIndex(Part, "CFrame")
  428. end)
  429.  
  430. Mortadex.HookManager:HookIndex("BasePart", "Transparency", function(Part)
  431. local caller_env = getfenv(1)
  432. if caller_env.script ~= Mortadex.UpvalScript and caller_env.script.ClassName ~= "CoreScript" then
  433. if Part.Name == "Head" then
  434. return 0
  435. end
  436. end
  437. return Mortadex.OriginalIndex(Part, "Transparency")
  438. end)
  439.  
  440. Mortadex:Log("Creating menu...")
  441. Mortadex.SelectionMenu = Mortadex:CreateWindow("Mortadex v"..Mortadex.Version, UDim2.new(0, 250, 0, 20 * Mortadex.ModuleCount))
  442. Mortadex.SelectionMenu.Position = UDim2.new(0, 10, 0, 10)
  443. Mortadex.SelectionMenu.CloseBtn:Destroy()
  444.  
  445. for ModuleName, Module in next, Mortadex.Modules do
  446. local Entry = Instance.new("TextLabel")
  447. Entry.BackgroundTransparency = 1
  448. Entry.BackgroundColor3 = Color3.new(1,1,1)
  449. Entry.TextColor3 = Color3.new(1, 1, 1)
  450. Entry.TextScaled = true
  451. Entry.Font = "Code"
  452. Entry.TextXAlignment = "Left"
  453. Entry.Text = ModuleName
  454. Entry.Position = UDim2.new(0, 0, 0, 20 * Module.Order)
  455. Entry.Size = UDim2.new(1, 0, 0, 20)
  456. Entry.Name = tostring(Module.Order)
  457. Entry.Parent = Mortadex.SelectionMenu.Content
  458. Entry.BorderSizePixel = 0
  459.  
  460. local Status = Instance.new("Frame")
  461. Status.BorderSizePixel = 0
  462. Status.BackgroundColor3 = Color3.new(1, 0, 0)
  463. Status.Size = UDim2.new(0, 5, 0, 5)
  464. Status.Position = UDim2.new(1, -10, 0, 8)
  465. Status.Name = "Status"
  466. Status.Parent = Entry
  467. end
  468.  
  469. Mortadex:Log("Connecting UI renderer...")
  470. Mortadex.Services.RunService:BindToRenderStep("Mortadex", Enum.RenderPriority.Last.Value + 1, function()
  471. for _, Object in next, Mortadex.Utilities:GetCanvas():GetChildren() do
  472. if not Object.Name:find("NO_CLEAR") then
  473. Object:Destroy()
  474. end
  475. end
  476.  
  477. for i, Module in next, Mortadex.Modules do
  478. if Module.Enabled and Module.OnRender then
  479. local Success, ErrMsg = pcall(Module.OnRender, Module.Scratchpad)
  480. if not Success then
  481. Mortadex:FLog("Panic during execution of \"%s\"::OnRender: %s", i, ErrMsg)
  482. end
  483. elseif not Module.Enabled and Module.NoRender then
  484. local Success, ErrMsg = pcall(Module.NoRender, Module.Scratchpad)
  485. if not Success then
  486. Mortadex:FLog("Panic during execution of \"%s\"::NoRender: %s", i, ErrMsg)
  487. end
  488. end
  489. end
  490. end)
  491.  
  492. Mortadex:Log("Attaching controls...")
  493. Mortadex.Services.UserInputService.InputBegan:connect(function(InputObject)
  494. local PreviousSelection = Mortadex.SelectionMenu.Content:FindFirstChild(tostring(Mortadex.ModuleSelection))
  495. if PreviousSelection then
  496. PreviousSelection.BackgroundTransparency = 1
  497. PreviousSelection.TextColor3 = Color3.new(1, 1, 1)
  498. end
  499. if InputObject.KeyCode.Name == "J" then
  500. Mortadex.ModuleSelection = Mortadex.ModuleSelection - 1
  501. if Mortadex.ModuleSelection < 0 then
  502. Mortadex.ModuleSelection = Mortadex.ModuleCount - 1
  503. end
  504. elseif InputObject.KeyCode.Name == "K" then
  505. Mortadex.ModuleSelection = Mortadex.ModuleSelection + 1
  506. if Mortadex.ModuleSelection > Mortadex.ModuleCount-1 then
  507. Mortadex.ModuleSelection = 0
  508. end
  509. elseif InputObject.KeyCode.Name == "L" then
  510. local EntryLabel = Mortadex.SelectionMenu.Content:FindFirstChild(tostring(Mortadex.ModuleSelection))
  511. if EntryLabel then
  512. local ModuleEntry = Mortadex.Modules[EntryLabel.Text]
  513. if ModuleEntry then
  514. ModuleEntry.Enabled = not ModuleEntry.Enabled
  515. if ModuleEntry.Enabled then
  516. EntryLabel.Status.BackgroundColor3 = Color3.new(0, 1, 0)
  517. else
  518. EntryLabel.Status.BackgroundColor3 = Color3.new(1, 0, 0)
  519. end
  520. end
  521. end
  522. elseif InputObject.KeyCode.Name == "P" then
  523. Mortadex.SelectionMenu.Position = UDim2.new(1, -270, 0, 10)
  524. end
  525. local EntryLabel = Mortadex.SelectionMenu.Content:FindFirstChild(tostring(Mortadex.ModuleSelection))
  526. if EntryLabel then
  527. EntryLabel.BackgroundTransparency = .3
  528. EntryLabel.TextColor3 = Color3.new(0, 0, 0)
  529. end
  530. end)
  531.  
  532. Mortadex:Log("Finishing up...")
  533. local IntroWindow = Mortadex:CreateWindow("Mortadex", UDim2.new(0, 350, 0, 200), 5, true)
  534. local IntroLabel = Instance.new("TextLabel")
  535. IntroLabel.Font = "Code"
  536. IntroLabel.TextWrapped = true
  537. IntroLabel.FontSize = "Size24"
  538. IntroLabel.TextColor3 = Color3.new(1, 1, 1)
  539. IntroLabel.BackgroundTransparency = 1
  540. IntroLabel.Text = "Welcome to Mortadex! If you need to change the menu's placement, simply drag the window around the screen. Press P to dock the window to the right side of the screen in case the chat blocks the menu."
  541. IntroLabel.Parent = IntroWindow.Content
  542. IntroLabel.Size = UDim2.new(1, 0, 1, 0)
Advertisement
RAW Paste Data Copied
Advertisement