ScriptingFluff

[ROBLOX]Phantom Forces

Feb 17th, 2020
513
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.45 KB | None | 0 0
  1. local ver = 4.5
  2.  
  3. local UIS = game:GetService("UserInputService")
  4. local TweenService = game:GetService("TweenService")
  5. local Players = game:GetService("Players")
  6. local LocalPlayer = Players.LocalPlayer
  7.  
  8. local MoveMouse = mousemoverel or Input.MoveMouse or function() warn("ur executor is trash, aimbot won't work") end
  9.  
  10. local Gui = Instance.new("ScreenGui",LocalPlayer.PlayerGui)
  11.  
  12. local MouseDown = false
  13. local ActiveElement = nil
  14. local Aim = false
  15.  
  16. local Theme = {PrimaryColor=Color3.fromRGB(255,200,0),SecondaryColor=Color3.fromRGB(50,50,50)}
  17.  
  18. local MainMenu = {}
  19.  
  20. function RoundToStep(Value,Step)
  21. local mod = (Value%Step)/Step
  22. local rounded = (mod>.5 and 1 or 0)
  23. return Value-(Value%Step)+rounded*Step
  24. end
  25.  
  26. --Menu Classes
  27. local UIBase = {Edges={},Classes={}}
  28. local Label={Name=""}
  29. local Bool={}
  30. local Separator={}
  31. local Slider={}
  32. local SliderLabel={}
  33. local Color={}
  34. local ColorPicker={}
  35. local DropDown={}
  36. local Menu={}
  37.  
  38. do
  39. function UIBase.new(Owner)
  40. local self = {}
  41. setmetatable(self,{__index=UIBase})
  42. self.Owner = Owner
  43. self.Classes["UIBase"] = true
  44.  
  45. local Frame = Instance.new("Frame")
  46. Frame.Size = UDim2.new(0,200,0,20)
  47. Frame.BackgroundColor3 = Theme.SecondaryColor
  48. Frame.BorderSizePixel = 0
  49. Frame.BackgroundTransparency = .2
  50. Frame.ClipsDescendants = false
  51. Frame.Name="BG"
  52. Frame.Parent = self.Owner and self.Owner.ClippingFrame or Gui
  53.  
  54. local hr = Instance.new("Frame")
  55. hr.AnchorPoint=Vector2.new(.5,.5)
  56. hr.Position=UDim2.new(.5,0,0,0)
  57. hr.Size=UDim2.new(1,0,0,1)
  58. hr.BackgroundColor3=Theme.PrimaryColor
  59. hr.BorderSizePixel=0
  60. hr.Parent = Frame
  61.  
  62. local top = hr
  63. local bottom = top:Clone()
  64. bottom.Position = UDim2.new(.5,0,1,-1)
  65. bottom.Parent = Frame
  66.  
  67. local vr = Instance.new("Frame")
  68. vr.AnchorPoint=Vector2.new(.5,.5)
  69. vr.Position=UDim2.new(0,0,.5,0)
  70. vr.Size=UDim2.new(0,1,1,0)
  71. vr.BackgroundColor3=Theme.PrimaryColor
  72. vr.BorderSizePixel=0
  73. vr.Parent = Frame
  74.  
  75. local left = vr
  76. local right = left:Clone()
  77. right.Position = UDim2.new(1,-1,.5,0)
  78. right.Parent = Frame
  79.  
  80. self.Edges = {left,top,right,bottom}
  81. self.BG = Frame
  82.  
  83. if self.Owner and Owner.LastChild then
  84. top.Visible = false
  85. Owner.LastChild.Edges[4].Size = UDim2.new(1,-20,0,1)
  86. end
  87.  
  88. return self
  89. end
  90. function UIBase:IsA(className)
  91. return self.Classes["UIBase"]
  92. end
  93.  
  94. setmetatable(Label,{__index=UIBase})
  95. function Label.new(Owner,Name)
  96. local self = UIBase.new(Owner)
  97. setmetatable(self,{__index=Label})
  98. --SUPER
  99.  
  100. self.Classes["Label"]=true
  101. self.Name=Name or self.Name
  102. --text
  103. local Label=Instance.new("TextLabel")
  104. Label.Size=UDim2.new(0,150,0,20)
  105. Label.BackgroundColor3=Color3.fromRGB(50,50,50)
  106. Label.BorderSizePixel=0
  107. Label.BackgroundTransparency=1
  108. Label.Text=Name or "Bool"
  109. Label.TextColor3=Theme.PrimaryColor
  110. Label.TextXAlignment=Enum.TextXAlignment.Left
  111. Label.TextSize=10
  112. Label.Position=UDim2.new(0,10,0,0)
  113. Label.Parent=self.BG
  114. self.Label=Label
  115.  
  116. return self
  117. end
  118.  
  119. setmetatable(Separator,{__index=UIBase})
  120. function Separator.new(Owner)
  121. local self = UIBase.new(Owner,"")
  122. setmetatable(self,{__index=Separator})
  123. --SUPER
  124.  
  125. self.Classes["Separator"]=true
  126.  
  127. return self
  128. end
  129.  
  130. setmetatable(Bool,{__index=Label})
  131. function Bool.new(Owner,Name,Value)
  132. local self=Label.new(Owner,Name)
  133. setmetatable(self,{__index=Bool})
  134. --SUPER INIT
  135.  
  136. self.Classes["Bool"]=true
  137. self.Classes["Label"]=false --hide label inheritance cos that's gonna cause some awkward behaviours for devs using the library
  138. self._Value=Value
  139. self.ValueChanged=Instance.new("BindableEvent")
  140.  
  141. --checkbox
  142. local Box=Instance.new("TextButton")
  143. Box.Size=UDim2.new(0,10,0,10)
  144. Box.Position=UDim2.new(1,-26,0,10)
  145. Box.AnchorPoint=Vector2.new(0,.5)
  146. Box.BorderSizePixel=0
  147. Box.Text=""
  148. Box.BackgroundColor3=Value and Color3.new(0,1,0) or Color3.new(1,0,0)
  149. Box.AutoButtonColor=false
  150. Box.MouseButton1Click:Connect(function()
  151. self:SetValue(not self._Value)
  152. ActiveElement=self
  153. end)
  154. Box.Parent=self.BG
  155. self.Box=Box
  156. return self
  157. end
  158. function Bool:SetValue(Value)
  159. self.ValueChanged:Fire(Value)
  160. self._Value=Value
  161. self.Box.BackgroundColor3=Value and Color3.new(0,1,0) or Color3.new(1,0,0)
  162. end
  163. function Bool:GetValue()
  164. return self._Value
  165. end
  166.  
  167. setmetatable(Slider,{__index=Label})
  168. function Slider.new(Owner,Name,Min,Max,Value,Step)
  169. local self = Label.new(Owner,Name)
  170. setmetatable(self,{__index=Slider})
  171. --SUPER INIT
  172.  
  173. Value = math.clamp(Value,Min,Max)
  174. self.Classes["Slider"]=true
  175. self.Classes["Label"]=false--same gig
  176. self.Min=Min or 0
  177. self.Max=Max or 10
  178. self.Step=Step or 1
  179. self._Value=RoundToStep(Value or (self.Min+self.Max)/2,self.Step)
  180. self.ValueChanged=Instance.new("BindableEvent")
  181.  
  182. --sliderail
  183. local f = Instance.new("Frame")
  184. f.Size = UDim2.new(0,70,0,5)
  185. f.AnchorPoint=Vector2.new(0,.5)
  186. f.Position=UDim2.new(0,110,.5,0)
  187. f.BorderSizePixel=0
  188. f.BackgroundColor3=Color3.new(.8,.8,.8)
  189. f.Parent=self.BG
  190. self.Rail=f
  191.  
  192. --slidenotch
  193. local n = Instance.new("Frame")
  194. n.Size=UDim2.new(0,5,0,10)
  195. n.AnchorPoint=Vector2.new(.5,.5)
  196. n.Position=UDim2.new(0,0,.5,0)
  197. n.BorderSizePixel=0
  198. n.BackgroundColor3=Color3.new(1,1,1)
  199. n.Parent=f
  200. self.Notch=n
  201.  
  202. --clicklistener
  203. local b = Instance.new("TextButton")
  204. b.Text=""
  205. b.Size=UDim2.new(0,70,0,20)
  206. b.ZIndex=2
  207. b.Position=UDim2.new(0,0,0,-8)
  208. b.BackgroundTransparency=1
  209. b.Parent=f
  210. b.MouseButton1Down:Connect(function()
  211. ActiveElement = self
  212. end)
  213. b.MouseButton1Up:Connect(function()
  214. if ActiveElement==self then
  215. ActiveElement=nil
  216. end
  217. end)
  218. self.Button=b
  219.  
  220. self:SetValue(Value)
  221. return self
  222. end
  223. function Slider:SetValue(Value)
  224. self.ValueChanged:Fire(Value)
  225. self._Value=Value
  226. local k = (self._Value-self.Min)/(self.Max-self.Min)
  227. self.Notch.Position=UDim2.new(k,0,.5,0)
  228. end
  229. function Slider:GetValue()
  230. return self._Value
  231. end
  232.  
  233. setmetatable(SliderLabel,{__index=Label})
  234. function SliderLabel.new(Owner,Slider)
  235. local self = Label.new(Owner,Slider:GetValue())
  236. setmetatable(self,{__index=SliderLabel})
  237. --SUPER INIT
  238.  
  239. Slider.ValueChanged.Event:Connect(function(NewValue)
  240. self.Label.Text=NewValue
  241. end)
  242.  
  243. return self
  244. end
  245.  
  246. setmetatable(Color,{__index=UIBase})
  247. function Color.new(Owner,Value)
  248. local self = UIBase.new(Owner)
  249. setmetatable(self,{__index=Color})
  250. --SUPER INIT
  251.  
  252. self._Value = Value or Color3.new(1,1,1)
  253. self.ValueChanged=Instance.new("BindableEvent")
  254.  
  255. --indicator
  256. local f = Instance.new("Frame")
  257. f.Size = UDim2.new(0,14,0,14)
  258. f.AnchorPoint = Vector2.new(.5,.5)
  259. f.Position=UDim2.new(.5,0,.5,0)
  260. f.BorderSizePixel = 0
  261. f.BackgroundTransparency=0
  262. f.BackgroundColor3=Value
  263. f.Parent = self.BG
  264. self.Indicator=f
  265.  
  266. return self
  267. end
  268. function Color:SetValue(Value)
  269. self._Value=Value
  270. self.ValueChanged:Fire(Value)
  271. self.Indicator.BackgroundColor3=Value
  272. end
  273. function Color:GetValue()
  274. return self._Value
  275. end
  276.  
  277. setmetatable(ColorPicker,{__index=Menu})
  278. function ColorPicker.new(Owner,Name,Value)
  279. local self = Menu.new(Owner,Name)
  280. setmetatable(self,{__index=ColorPicker})
  281. --SUPER INIT
  282.  
  283. self.Arrow:Destroy()
  284. self._Value = Value or Color3.new(1,1,1)
  285. self.ValueChanged=Instance.new("BindableEvent")
  286.  
  287. --indicator
  288. local f = Instance.new("Frame")
  289. f.Size = UDim2.new(0,14,0,14)
  290. f.AnchorPoint = Vector2.new(.5,.5)
  291. f.Position=UDim2.new(1,-21,.5,0)
  292. f.BorderSizePixel = 0
  293. f.BackgroundTransparency=0
  294. f.BackgroundColor3=Value
  295. f.Parent = self.BG
  296. self.Indicator=f
  297.  
  298. local indicator = self:AddColorIndicator(Value)
  299.  
  300. local red = self:AddSlider("Red",0,1,Value.R,.01)
  301. red.ValueChanged.Event:Connect(function(NewValue)
  302. self._Value=Color3.new(NewValue,self._Value.G,self._Value.B)
  303. self.ValueChanged:Fire(self._Value)
  304. end)
  305. self.RedSlider = red
  306.  
  307. local green = self:AddSlider("Green",0,1,Value.G,.01)
  308. green.ValueChanged.Event:Connect(function(NewValue)
  309. self._Value=Color3.new(self._Value.R,NewValue,self._Value.B)
  310. self.ValueChanged:Fire(self._Value)
  311. end)
  312. self.GreenSlider = green
  313.  
  314. local blue = self:AddSlider("Blue",0,1,Value.B,.01)
  315. blue.ValueChanged.Event:Connect(function(NewValue)
  316. self._Value=Color3.new(self._Value.R,self._Value.G,NewValue)
  317. self.ValueChanged:Fire(self._Value)
  318. end)
  319. self.BlueSlider = blue
  320.  
  321. self.ValueChanged.Event:Connect(function(NewValue)
  322. indicator:SetValue(NewValue)
  323. f.BackgroundColor3=NewValue
  324. end)
  325.  
  326. return self
  327. end
  328. function ColorPicker:SetValue(Value)
  329. self._Value=Value
  330. self.ValueChanged.Event:Fire(Value)
  331.  
  332. self.RedSlider:SetValue(Value.R)
  333. self.GreenSlider:SetValue(Value.G)
  334. self.BlueSlider:SetValue(Value.B)
  335. end
  336.  
  337. function ColorPicker:GetValue()
  338. return self._Value
  339. end
  340.  
  341. setmetatable(DropDown, {__index=UIBase})
  342. function DropDown.new(Owner,...)
  343. local self = UIBase.new(Owner)
  344. setmetatable(self,{__index=DropDown})
  345. --SUPERI NIT
  346.  
  347. self.Classes["DropDown"]=true
  348.  
  349. local args = {...}
  350.  
  351. --TextButton
  352. local Button=Instance.new("TextButton")
  353. Button.Size=UDim2.new(0,200,0,20)
  354. Button.Position=UDim2.new(0,0,0,0)
  355. Button.BackgroundTransparency=1
  356. Button.TextSize=10
  357. Button.Text=args[1]
  358. Button.TextColor3=Theme.PrimaryColor
  359. Button.Parent=self.BG
  360. self.Button=Button
  361.  
  362. --Clipping
  363. local Clipping=Instance.new("Frame")
  364. Clipping.Size=UDim2.new(0,200,0,20)
  365. Clipping.Position=UDim2.new(0,0,1,0)
  366. Clipping.BackgroundTransparency=1
  367. Clipping.ClipsDescendants=true
  368. Clipping.Parent=nil
  369. self.Clipping=Clipping
  370.  
  371. Instance.new("UIListLayout",Clipping)
  372.  
  373. for i=1,#args do
  374. local b = Button:Clone()
  375. b.Text=args[i]
  376. b.LayoutOrder=i
  377. b.BorderColor3=Theme.PrimaryColor
  378. b.BackgroundTransparency=0
  379. b.BackgroundColor3=Theme.SecondaryColor
  380. b.Parent=Clipping
  381. b.MouseButton1Click:Connect(function()
  382. self.Button.Text=args[i]
  383. self:Close()
  384. end)
  385. end
  386. self.args=args
  387.  
  388. self.Button.MouseButton1Click:Connect(function()
  389. if self.Clipping.Size.Y.Offset > 20 then
  390. self:Close()
  391. else
  392. self:Open()
  393. end
  394. end)
  395.  
  396. self.BG.Parent=Clipping
  397. self.BG=Clipping
  398. self.Clipping.Parent = Owner.ClippingFrame
  399.  
  400. return self
  401. end
  402. function DropDown:Open()
  403. local Tween = TweenService:Create(
  404. self.Clipping,
  405. TweenInfo.new(
  406. .2,
  407. Enum.EasingStyle.Linear,
  408. Enum.EasingDirection.Out,
  409. 0,
  410. false,
  411. 0
  412. ),
  413. {
  414. Size=UDim2.new(0,200,0,(#self.args+1)*20),
  415. }
  416. )
  417. Tween:Play()
  418. end
  419. function DropDown:Close()
  420. local Tween = TweenService:Create(
  421. self.Clipping,
  422. TweenInfo.new(
  423. .2,
  424. Enum.EasingStyle.Linear,
  425. Enum.EasingDirection.Out,
  426. 0,
  427. false,
  428. 0
  429. ),
  430. {
  431. Size=UDim2.new(0,200,0,20),
  432. }
  433. )
  434. Tween:Play()
  435. end
  436. function DropDown:GetValue()
  437. return self.Button.Text
  438. end
  439.  
  440. setmetatable(Menu,{__index=Label})
  441. function Menu.new(Owner,Name)
  442. local self = Label.new(Owner,Name)
  443. setmetatable(self,{__index=Menu})
  444. --SUPER INIT
  445.  
  446. self.Classes["Menu"]=true
  447. self.Classes["Label"]=false --hide label inheritance cos that's just weird to have
  448. self.Children = {}
  449. self.State="Closed"
  450. self.Owner=Owner or nil
  451. self.LastChild=nil
  452.  
  453. --arrow
  454. local Arrow=Instance.new("TextLabel")
  455. Arrow.Size=UDim2.new(0,20,0,20)
  456. Arrow.BackgroundTransparency=1
  457. Arrow.Text=">"
  458. Arrow.TextColor3=Theme.PrimaryColor
  459. Arrow.TextSize=10
  460. Arrow.Position=UDim2.new(1,-30,0,0)
  461. Arrow.Parent=self.BG
  462. self.Arrow=Arrow
  463.  
  464. --click catcher
  465. local Button = Instance.new("TextButton")
  466. Button.Size = UDim2.new(0,200,0,20)
  467. Button.BackgroundColor3 = Color3.fromRGB(50,50,50)
  468. Button.BorderSizePixel=0
  469. Button.BackgroundTransparency=1
  470. Button.ZIndex=2
  471. Button.Text=""
  472. Button.MouseButton1Click:Connect(function()
  473. if self.State=="Closed" then
  474. self:Open()
  475. else
  476. self:Close()
  477. end
  478. end)
  479. Button.Parent = self.BG
  480. self.Button=Button
  481.  
  482. --clipping rect
  483. local Frame = Instance.new("Frame")
  484. Frame.Size = UDim2.new(0,200,0,0)
  485. Frame.BackgroundColor3 = Color3.fromRGB(50,50,50)
  486. Frame.BorderSizePixel=0
  487. Frame.BackgroundTransparency=1
  488. Frame.ClipsDescendants = true
  489. Frame.Parent = Gui
  490. Frame.Position = self.Owner and self.Owner.ClippingFrame.Position+UDim2.new(0,200,0,0) or self.BG.Position+UDim2.new(0,200,0,0)
  491. Frame.Name="Clipping"
  492. self.ClippingFrame = Frame
  493.  
  494. local Order = Instance.new("UIListLayout")
  495. Order.SortOrder=Enum.SortOrder.LayoutOrder
  496. Order.Parent=self.ClippingFrame
  497.  
  498. return self
  499. end
  500. function Menu:Open()
  501. if self.Owner then
  502. for i,v in pairs(self.Owner.Children) do
  503. if v.Close then v:Close() end
  504. end
  505. end
  506. local Tween = TweenService:Create(
  507. self.ClippingFrame,
  508. TweenInfo.new(
  509. .2,
  510. Enum.EasingStyle.Linear,
  511. Enum.EasingDirection.Out,
  512. 0,
  513. false,
  514. 0
  515. ),
  516. {
  517. Size=UDim2.new(0,200,1,20*#self.Children),
  518. Visible=true
  519. }
  520. )
  521. self.ClippingFrame.Visible = true
  522. Tween:Play()
  523. self.State="Open"
  524. end
  525. function Menu:Close()
  526. for i,v in pairs(self.Children) do
  527. if v.Close then
  528. v:Close()
  529. end
  530. end
  531. local Tween = TweenService:Create(
  532. self.ClippingFrame,
  533. TweenInfo.new(
  534. .2,
  535. Enum.EasingStyle.Linear,
  536. Enum.EasingDirection.Out,
  537. 0,
  538. false,
  539. 0
  540. ),
  541. {
  542. Size=UDim2.new(0,200,0,0),
  543. Visible=false
  544. }
  545. )
  546. Tween:Play()
  547. self.State="Closed"
  548. end
  549. function Menu:_AddChild(Child)
  550. Child.BG.LayoutOrder = #self.Children
  551. table.insert(self.Children,Child)
  552. self.LastChild=Child
  553. end
  554. function Menu:AddSubMenu(Name)
  555. local m = Menu.new(self,Name)
  556. m.ClippingFrame.Position=self.ClippingFrame.Position+UDim2.new(0,200,0,0)
  557. self:_AddChild(m)
  558. return m
  559. end
  560. function Menu:AddLabel(Name)
  561. local l = Label.new(self,Name)
  562. self:_AddChild(l)
  563. return l
  564. end
  565. function Menu:AddBool(Name,Value)
  566. local b = Bool.new(self,Name,Value)
  567. self:_AddChild(b)
  568. return b
  569. end
  570. function Menu:AddSlider(Name,Min,Max,Value,Step)
  571. local s = Slider.new(self,Name,Min,Max,Value,Step)
  572. self:_AddChild(s)
  573. return s
  574. end
  575. function Menu:AddSliderLabel(Slider)
  576. local sl = SliderLabel.new(self,Slider)
  577. self:_AddChild(sl)
  578. return sl
  579. end
  580. function Menu:AddColorIndicator(Value)
  581. local c = Color.new(self,Value)
  582. self:_AddChild(c)
  583. return c
  584. end
  585. function Menu:AddColorPicker(Name,Value)
  586. local cp = ColorPicker.new(self,Name,Value)
  587. self:_AddChild(cp)
  588. return cp
  589. end
  590. function Menu:AddDropDown(...)
  591. local args={...}
  592. local dd = DropDown.new(self,unpack(args))
  593. self:_AddChild(dd)
  594. return dd
  595. end
  596.  
  597. --menu functionality hooks
  598. UIS.InputBegan:Connect(function(Input,Processed)
  599. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  600. MouseDown=true
  601. elseif Input.UserInputType == Enum.UserInputType.MouseButton2 then
  602. Aim = true
  603. elseif Input.UserInputType == Enum.UserInputType.Keyboard and Input.KeyCode == Enum.KeyCode.Insert then
  604. if MainMenu.BG.Visible then
  605. MainMenu:Close()
  606. MainMenu.BG.Visible=false
  607. else
  608. MainMenu.BG.Visible=true
  609. end
  610. end
  611. end)
  612. UIS.InputEnded:Connect(function(Input,Processed)
  613. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  614. MouseDown=false
  615. ActiveElement=nil
  616. elseif Input.UserInputType == Enum.UserInputType.MouseButton2 then
  617. Aim = false
  618. end
  619. end)
  620. local mouse = LocalPlayer:GetMouse()
  621. game:GetService("RunService").RenderStepped:Connect(function(dT)
  622. if MouseDown and ActiveElement then
  623. if ActiveElement:IsA("Slider") then
  624. local mX = mouse.X
  625. local dX = mX-ActiveElement.Rail.AbsolutePosition.X
  626. local Frac = dX/ActiveElement.Rail.AbsoluteSize.X
  627. Frac=math.clamp(Frac,0,1)
  628. local RoughValue = ActiveElement.Min + (ActiveElement.Max-ActiveElement.Min)*Frac
  629. local Value = RoundToStep(RoughValue,ActiveElement.Step)
  630. ActiveElement:SetValue(Value)
  631. end
  632. end
  633. end)
  634.  
  635. end
  636. --MENU SOURCE CODE
  637.  
  638. local m = Menu.new(nil,"PFMaster "..ver)
  639.  
  640. local ESPMenu = m:AddSubMenu("ESP")
  641. local ESPEnabled = ESPMenu:AddBool("Enabled",true)
  642. local EnemyColor = ESPMenu:AddColorPicker("Enemy Color",Color3.new(1,0,0))
  643. local FriendlyColor = ESPMenu:AddColorPicker("Friendly Color",Color3.new(0,1,0))
  644. local VisibleColor = ESPMenu:AddColorPicker("Enemy Visible Color",Color3.new(1,.588,0))
  645. local ESPTransparency = ESPMenu:AddSlider("Transparency",0,1,.5,.01)
  646. ESPMenu:AddSliderLabel(ESPTransparency)
  647. local ESPRate = ESPMenu:AddSlider("TickRate",3,30,20,1)
  648. ESPMenu:AddSliderLabel(ESPRate)
  649.  
  650. local AimbotMenu = m:AddSubMenu("Aimbot")
  651. local AimbotEnabled = AimbotMenu:AddBool("Enabled",true)
  652. local AimSens = AimbotMenu:AddSlider("Speed",0,1.5,1,.01)
  653. AimbotMenu:AddSliderLabel(AimSens)
  654. local AimbotCalcDrop = AimbotMenu:AddBool("Calculate drop",true)
  655. local AimbotCalcMovement = AimbotMenu:AddBool("Calculate movement",true)
  656. AimbotMenu:AddLabel("Aim Bone")
  657. local AimBone = AimbotMenu:AddDropDown("Head","Torso","Left Arm","Right Arm")
  658. local AimLimit = AimbotMenu:AddSlider("Max Angle",15,180,180,5)
  659. AimbotMenu:AddSliderLabel(AimLimit)
  660.  
  661. local HackMenu = m:AddSubMenu("Hacks")
  662. local NoSpread = HackMenu:AddBool("No Spread",false)
  663. local NoRecoil = HackMenu:AddBool("No Recoil",false)
  664. local FastReload = HackMenu:AddBool("Instant Reload",false)
  665. local RapidFire = HackMenu:AddBool("Rapid Fire",false)
  666. local FireRate = HackMenu:AddSlider("Fire Rate",300,1200,600,25)
  667. HackMenu:AddSliderLabel(FireRate)
  668. local NoSway = HackMenu:AddBool("No Sway",false)
  669. local NoFlash = HackMenu:AddBool("No Flash",false)
  670. local InstantAim = HackMenu:AddBool("Instant Aim")
  671. local MoveSpeed = HackMenu:AddBool("SpeedHack",false)
  672. local MoveSlider = HackMenu:AddSlider("Speed",10,40,20,1)
  673. HackMenu:AddSliderLabel(MoveSlider)
  674.  
  675. m:AddLabel("PFMaster v"..ver.." by Fret")
  676. m:AddLabel("Built with MasterGui v1.0")
  677. MainMenu=m
  678.  
  679. local CamWrapper = {}
  680. CamWrapper.cam = workspace.CurrentCamera
  681. function CamWrapper:CanSee(Part)
  682. local Ray=Ray.new(self.cam.CFrame.p,(Part.Position-self.cam.CFrame.p)*1.1)
  683. local Ignore = {LocalPlayer.Character,self.cam}
  684. local part=workspace:FindPartOnRayWithIgnoreList(Ray,Ignore)
  685. return part==Part or not part
  686. end
  687. function CamWrapper:CamAngleTo(Position)
  688. local lookVec = self.cam.CFrame.LookVector
  689. local dVec = (Position-self.cam.CFrame.p).unit
  690. return math.acos(lookVec:Dot(dVec))
  691. end
  692. function CamWrapper:Update()
  693. self.cam=workspace.CurrentCamera
  694. end
  695.  
  696. local Delayed={}
  697. function DelayAction(Action,t)
  698. Delayed[tick()+t]=Action
  699. end
  700. function DelayEvaluate()
  701. for i,v in pairs(Delayed) do
  702. if tick()>i then
  703. v()
  704. Delayed[i]=nil
  705. end
  706. end
  707. end
  708.  
  709. local activeslot = 1
  710. local bulletspeeds = {[1]=2000}--default assume 2k mvel
  711. local PrimaryTypes = {
  712. ["ASSAULT"]=true,
  713. ["SNIPER"]=true,
  714. ["PDW"]=true,
  715. ["DMR"]=true,
  716. ["BATTLE"]=true,
  717. ["CARBINE"]=true,
  718. ["SHOTGUN"]=true,
  719. ["LMG"]=true
  720. }
  721. local HackManager = {}
  722. function HackManager:Load()
  723. for i,v in pairs(getgc()) do
  724. if type(v) == "table" then
  725. if rawget(v,"addgun") then
  726. self.char = v
  727. print("foundchar")
  728. elseif rawget(v,"send") then
  729. self.networking = v
  730. print("foundnetworking")
  731. end
  732. end
  733. end
  734. if not self.char then
  735. warn("failed to find char")
  736. print("FIND CHAR ATTEMPT#2")
  737. local found = false
  738. for i,v in pairs(getgc()) do
  739. if type(v)=="function" and islclosure(v) then
  740. for _,upvalue in pairs(debug.getupvalues(v)) do
  741. if type(upvalue)==type({}) and (rawget(upvalue,"addgun") or rawget(upvalue,"loadgrenade")) then
  742. self.char = upvalue
  743. print("foundchar")
  744. found=true
  745. break
  746. end
  747. end
  748. if found then break end
  749. end
  750. end
  751. end
  752.  
  753. self.OldLoadGun = self.char.addgun
  754. self.char.addgun = function(gundatawrapper)
  755. local GunData = gundatawrapper.data
  756.  
  757. if PrimaryTypes[GunData.type] then
  758. --bulletspeed = GunData.bulletspeed
  759. bulletspeeds[activeslot]=GunData.bulletspeed
  760. print("SETBULLETSPEED",GunData.bulletspeed)
  761. end
  762.  
  763. if NoSpread:GetValue() then
  764. GunData.hipfirespread = 0
  765. GunData.hipfirestability = 0
  766. GunData.hipfirerecovery = 100
  767. end
  768. if NoRecoil:GetValue() then
  769. for i,v in pairs(GunData) do
  770. if i:lower():find("kick") and not i:lower():find("speed") and type(v)=="userdata" then
  771. GunData[i]=v.unit*1/1000
  772. end
  773. end
  774. end
  775. if FastReload:GetValue() then
  776. for i,v in pairs(GunData.animations) do
  777. if i:lower():find("reload") or i:lower():find("pullbolt") or i:lower():find("onfire") then
  778. v.timescale=0
  779. end
  780. end
  781.  
  782. end
  783. if RapidFire:GetValue() then
  784. GunData.firerate = FireRate:GetValue()
  785. GunData.variablefirerate = false
  786. GunData.firemodes = {true}
  787. GunData.requirechamber = false
  788. end
  789. if NoSway:GetValue() then
  790. GunData.swayamp=0
  791. GunData.swayspeed=0
  792. GunData.steadyspeed=0
  793. GunData.breathspeed=0
  794. end
  795. if NoFlash:GetValue() then
  796. GunData.hideflash=true
  797. GunData.hideminimap=true
  798. end
  799. if InstantAim:GetValue() then
  800. GunData.aimspeed = 100
  801. GunData.magnifyspeed = 100
  802. end
  803. if MoveSpeed:GetValue() then
  804. GunData.walkspeed = MoveSlider:GetValue()
  805. end
  806.  
  807. return self.OldLoadGun(gundatawrapper)
  808. end
  809. end
  810. HackManager:Load()
  811.  
  812. local ESP = {}
  813. ESP.LastRay = 0
  814. ESP.Characters = {}
  815. ESP.GlowInstances = {}
  816. ESP.GUIs={}
  817. ESP.GlowStringHash={
  818. Enemy=false,
  819. Friendly=true
  820. }
  821. function ESP:Load()
  822. self.Enabled = ESPEnabled:GetValue()
  823. ESPEnabled.ValueChanged.Event:Connect(function(Value)
  824. self.Enabled = Value
  825. if not Value then
  826. self.Characters = {}
  827. for Character,InstanceTable in pairs(self.GlowInstances) do
  828. for _,Glow in pairs(InstanceTable) do
  829. Glow:Destroy()
  830. end
  831. end
  832. self.GlowInstances={}
  833. --clean up tables
  834. end
  835. end)
  836.  
  837. self.EnemyColor=EnemyColor:GetValue()
  838. EnemyColor.ValueChanged.Event:Connect(function(Value)
  839. self.EnemyColor=Value
  840. self:DoGlowColors("Enemy")
  841. end)
  842.  
  843. self.FriendlyColor=FriendlyColor:GetValue()
  844. FriendlyColor.ValueChanged.Event:Connect(function(Value)
  845. self.FriendlyColor=Value
  846. self:DoGlowColors("Friendly")
  847. end)
  848.  
  849. self.VisibleColor=VisibleColor:GetValue()
  850. VisibleColor.ValueChanged.Event:Connect(function(Value)
  851. self.VisibleColor=Value
  852. self:DoGlowColors("Enemy")
  853. end)
  854.  
  855. self.GlowTransparency = ESPTransparency:GetValue()
  856. ESPTransparency.ValueChanged.Event:Connect(function(Value)
  857. self.GlowTransparency=Value
  858. self:DoGlowTransparency()
  859. end)
  860. end
  861. function ESP:DoGlowTransparency()
  862. for Character,GlowTable in pairs(self.GlowInstances) do
  863. for _,GlowObj in pairs(GlowTable) do
  864. GlowObj.Transparency = self.GlowTransparency
  865. end
  866. end
  867. end
  868. function ESP:CalculateColor(Player,Part)
  869. return Player.Team==LocalPlayer.Team and self.FriendlyColor or (CamWrapper:CanSee(Part) and self.VisibleColor or self.EnemyColor)
  870. end
  871. function ESP:TickPlayer(Player,Character)
  872. local Glows = self.GlowInstances[Character]
  873. if not Glows then return end
  874. for i,v in pairs(Glows) do
  875. v.Color3 = self:CalculateColor(Player,v.Adornee)
  876. end
  877. end
  878. function ESP:DoGlowColors(HashInput)
  879. local HashInputValue = self.GlowStringHash[HashInput]
  880. for Player,Character in pairs(self.Characters) do
  881. if (Player.Team==LocalPlayer.Team)==HashInputValue then
  882. for _,GlowObj in pairs(self.GlowInstances[Character]) do
  883. GlowObj.Color3 = HashInputValue and self.FriendlyColor or (CamWrapper:CanSee(GlowObj.Adornee) and self.VisibleColor or self.EnemyColor)
  884. end
  885. end
  886. end
  887. end
  888. function ESP:TagChar(Player,Character)
  889. local OldCharacter = self.Characters[Player]
  890. if OldCharacter then
  891. local OldGlows = self.GlowInstances[OldCharacter]
  892. if OldGlows then
  893. for i,v in pairs(OldGlows) do
  894. v:Destroy()
  895. end
  896. end
  897. end
  898. self.Characters[Player]=Character
  899. local NewGlows = {}
  900. for i,v in pairs(Character:GetChildren()) do
  901. if v:IsA("BasePart") then
  902. local g = Instance.new("BoxHandleAdornment")
  903. g.Color3=self:CalculateColor(Player,v)
  904. g.Adornee=v
  905. g.AlwaysOnTop=true
  906. g.Size=v.Size
  907. g.ZIndex=1
  908. g.Visible=true
  909. g.Transparency=self.GlowTransparency
  910. g.Parent=workspace
  911.  
  912. NewGlows[v]=g
  913.  
  914. local event
  915. event = v.AncestryChanged:Connect(function()
  916. if not v:IsDescendantOf(workspace) then
  917. g:Destroy()
  918. event:Disconnect()
  919. end
  920. end)
  921. end
  922. end
  923. self.GlowInstances[Character]=NewGlows
  924. end
  925. function ESP:Update()
  926. if not self.Enabled then return end
  927.  
  928. local UpdateColors = false
  929. if tick()-self.LastRay>1/ESPRate:GetValue() then
  930. UpdateColors=true
  931. self.LastRay=tick()
  932. end
  933. for i,Player in pairs(Players:GetPlayers()) do
  934. if Player~=LocalPlayer then
  935. local Char = Player.Character
  936. if Char ~= self.Characters[Player] then
  937. self:TagChar(Player,Char)
  938. end
  939. if UpdateColors then
  940. self:TickPlayer(Player,Char)
  941. end
  942.  
  943. end
  944. end
  945. end
  946. ESP:Load()
  947.  
  948. local Aimbot={}
  949. Aimbot.FrameCache={}
  950. function Aimbot:Load()
  951. self.Enabled = AimbotEnabled:GetValue()
  952. AimbotEnabled.ValueChanged.Event:Connect(function(Value)
  953. self.Enabled = Value
  954. end)
  955.  
  956. self.Sens = AimSens:GetValue()
  957. AimSens.ValueChanged.Event:Connect(function(Value)
  958. self.Sens = Value
  959. end)
  960.  
  961. self.Drop = AimbotCalcDrop:GetValue()
  962. AimbotCalcDrop.ValueChanged.Event:Connect(function(Value)
  963. self.Drop = Value
  964. end)
  965.  
  966. self.Movement = AimbotCalcMovement:GetValue()
  967. AimbotCalcMovement.ValueChanged.Event:Connect(function(Value)
  968. self.Movement = Value
  969. end)
  970. end
  971. function Aimbot:Update(dT)
  972. local aimpart = AimBone:GetValue()
  973. local bulletspeed = bulletspeeds[activeslot]
  974. if self.Enabled and Aim then
  975. local closest,distance,player = nil,math.huge,nil
  976. for _,Player in pairs(Players:GetPlayers()) do
  977. local char = Player.Character
  978. if char and char:FindFirstChild(aimpart) and Player.Team ~= LocalPlayer.Team and char:IsDescendantOf(workspace) then
  979. local head = char[aimpart]
  980. DelayAction(function()
  981. self.FrameCache[Player] = {tick(),head.Position}
  982. end,0)
  983.  
  984. local dVec = (CamWrapper.cam.CFrame.p-head.Position)*-1
  985. local ray = Ray.new(CamWrapper.cam.CFrame.p,dVec)
  986. local part,pos = workspace:FindPartOnRayWithIgnoreList(ray, {workspace.Ignore, LocalPlayer.Character, CamWrapper.cam})
  987. local angle = math.deg(math.acos(dVec.unit:Dot(CamWrapper.cam.CFrame.LookVector)))
  988. if (not part or part:IsDescendantOf(char)) and angle < AimLimit:GetValue() then
  989. --visibility check
  990.  
  991. local distance2 = CamWrapper:CamAngleTo(head.Position)
  992. if distance2<distance then
  993. closest = head
  994. distance = distance2
  995. player=Player
  996. end
  997. --closest head logic
  998.  
  999. end
  1000. end
  1001. end
  1002.  
  1003. if closest then
  1004. local traveltime = (closest.Position-CamWrapper.cam.CFrame.p).magnitude/bulletspeed
  1005. local bufferDiff = Vector3.new()
  1006. pcall(function()
  1007. bufferDiff = (closest.Position - self.FrameCache[player][2])/(tick()-self.FrameCache[player][1]) or closest.Position
  1008. end)
  1009. --catch no cached player position error
  1010. bufferDiff = bufferDiff * traveltime * 2 * (self.Movement and 1 or 0)
  1011. local drop = Vector3.new(0,11,0)*traveltime*(self.Drop and 1 or 0)
  1012. local screenPos,visible = CamWrapper.cam:WorldToScreenPoint(bufferDiff+closest.Position+drop)
  1013. local mult = (visible and 1 or -1 ) * self.Sens * .5
  1014. local mouse = LocalPlayer:GetMouse()
  1015. local pos2d = Vector2.new(screenPos.X,screenPos.Y)
  1016.  
  1017. --AimFrame.Position = UDim2.new(0,pos2d.X,0,pos2d.Y)
  1018.  
  1019.  
  1020.  
  1021. local relativePos = pos2d-Vector2.new(mouse.ViewSizeX,mouse.ViewSizeY)/2
  1022. local maxMag = math.min(relativePos.Magnitude, 150)
  1023. relativePos = relativePos.unit * maxMag * mult
  1024.  
  1025. MoveMouse(relativePos.X,relativePos.Y)
  1026.  
  1027. end
  1028. end
  1029. end
  1030. Aimbot:Load()
  1031.  
  1032. game:GetService("RunService").RenderStepped:Connect(function(dT)
  1033. CamWrapper:Update()
  1034. ESP:Update()
  1035. Aimbot:Update(dT)
  1036. DelayEvaluate()
  1037. end)
  1038. Gui.DisplayOrder = 9999
Add Comment
Please, Sign In to add comment