DragonSploitsYT

Phantom Forces Aimbot Script

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