Advertisement
replic8

Untitled

Jul 22nd, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 180.13 KB | None | 0 0
  1. --Created with PenguinAnonymous's compiler
  2. --PenguinAnonymous is not responsible for damages caused to your game
  3. --This plugin does not remove things
  4. --PenguinAnonymous cannot be held resonsible for manual deletion for the purpose of testing
  5. --Keep in mind, any items that cause errors in compilation will be skipped and documented within the last line of the disclaimer comments
  6. --Thank you for using my plugin and enjoy :)
  7. --It is free to use
  8. --If you use this plugin to create your own, please give me credit
  9. --Errors: RotateP,ModuleScript,UnionOperation,TouchTransmitter,Camera
  10. local runDummyScript = function(f,scri)
  11. local oldenv = getfenv(f)
  12. local newenv = setmetatable({}, {
  13. __index = function(_, k)
  14. if k:lower() == 'script' then
  15. return scri
  16. else
  17. return oldenv[k]
  18. end
  19. end
  20. })
  21. setfenv(f, newenv)
  22. ypcall(function() f() end)
  23. end
  24. cors = {}
  25. mas = Instance.new("Model",game:GetService("Lighting"))
  26. mas.Name = "CompiledModel"
  27. o1 = Instance.new("Model")
  28. o2 = Instance.new("Part")
  29. o3 = Instance.new("Script")
  30. o4 = Instance.new("ForceField")
  31. o7 = Instance.new("ManualWeld")
  32. o8 = Instance.new("Model")
  33. o9 = Instance.new("Tool")
  34. o10 = Instance.new("LocalScript")
  35. o11 = Instance.new("IntValue")
  36. o12 = Instance.new("Folder")
  37. o15 = Instance.new("ScreenGui")
  38. o16 = Instance.new("ImageLabel")
  39. o17 = Instance.new("NumberValue")
  40. o18 = Instance.new("Frame")
  41. o19 = Instance.new("ImageLabel")
  42. o20 = Instance.new("TextLabel")
  43. o21 = Instance.new("Frame")
  44. o22 = Instance.new("TextLabel")
  45. o23 = Instance.new("Frame")
  46. o24 = Instance.new("TextLabel")
  47. o25 = Instance.new("Frame")
  48. o26 = Instance.new("TextLabel")
  49. o27 = Instance.new("Frame")
  50. o28 = Instance.new("TextLabel")
  51. o29 = Instance.new("Frame")
  52. o30 = Instance.new("Frame")
  53. o31 = Instance.new("TextLabel")
  54. o32 = Instance.new("TextLabel")
  55. o33 = Instance.new("TextLabel")
  56. o34 = Instance.new("TextLabel")
  57. o35 = Instance.new("TextLabel")
  58. o36 = Instance.new("Frame")
  59. o37 = Instance.new("TextLabel")
  60. o38 = Instance.new("TextLabel")
  61. o39 = Instance.new("TextLabel")
  62. o40 = Instance.new("Frame")
  63. o41 = Instance.new("TextLabel")
  64. o42 = Instance.new("Frame")
  65. o43 = Instance.new("Frame")
  66. o44 = Instance.new("Frame")
  67. o45 = Instance.new("Frame")
  68. o46 = Instance.new("Frame")
  69. o47 = Instance.new("Frame")
  70. o48 = Instance.new("Frame")
  71. o49 = Instance.new("Frame")
  72. o50 = Instance.new("Frame")
  73. o51 = Instance.new("Frame")
  74. o52 = Instance.new("Frame")
  75. o53 = Instance.new("Frame")
  76. o54 = Instance.new("Frame")
  77. o55 = Instance.new("Frame")
  78. o56 = Instance.new("Frame")
  79. o57 = Instance.new("Frame")
  80. o58 = Instance.new("Frame")
  81. o59 = Instance.new("Frame")
  82. o60 = Instance.new("Frame")
  83. o61 = Instance.new("Frame")
  84. o62 = Instance.new("Frame")
  85. o63 = Instance.new("Frame")
  86. o64 = Instance.new("Frame")
  87. o65 = Instance.new("Frame")
  88. o66 = Instance.new("Frame")
  89. o67 = Instance.new("Frame")
  90. o68 = Instance.new("TextLabel")
  91. o69 = Instance.new("TextLabel")
  92. o70 = Instance.new("Frame")
  93. o71 = Instance.new("Frame")
  94. o72 = Instance.new("ImageLabel")
  95. o73 = Instance.new("TextLabel")
  96. o74 = Instance.new("TextLabel")
  97. o75 = Instance.new("Frame")
  98. o76 = Instance.new("ImageLabel")
  99. o77 = Instance.new("TextLabel")
  100. o78 = Instance.new("TextLabel")
  101. o79 = Instance.new("Frame")
  102. o80 = Instance.new("TextLabel")
  103. o81 = Instance.new("TextLabel")
  104. o82 = Instance.new("TextLabel")
  105. o83 = Instance.new("Frame")
  106. o84 = Instance.new("Frame")
  107. o85 = Instance.new("ImageLabel")
  108. o86 = Instance.new("ImageLabel")
  109. o87 = Instance.new("Frame")
  110. o88 = Instance.new("TextLabel")
  111. o89 = Instance.new("Frame")
  112. o90 = Instance.new("ImageLabel")
  113. o91 = Instance.new("ImageLabel")
  114. o92 = Instance.new("Frame")
  115. o93 = Instance.new("Frame")
  116. o94 = Instance.new("LocalScript")
  117. o95 = Instance.new("TextLabel")
  118. o107 = Instance.new("Part")
  119. o108 = Instance.new("CylinderMesh")
  120. o109 = Instance.new("Part")
  121. o110 = Instance.new("CylinderMesh")
  122. o111 = Instance.new("Part")
  123. o112 = Instance.new("CylinderMesh")
  124. o115 = Instance.new("Part")
  125. o116 = Instance.new("BlockMesh")
  126. o117 = Instance.new("Part")
  127. o118 = Instance.new("BlockMesh")
  128. o119 = Instance.new("Sound")
  129. o120 = Instance.new("Sound")
  130. o122 = Instance.new("IntValue")
  131. o123 = Instance.new("IntValue")
  132. o124 = Instance.new("IntValue")
  133. o125 = Instance.new("IntValue")
  134. o126 = Instance.new("IntValue")
  135. o127 = Instance.new("Script")
  136. o128 = Instance.new("Script")
  137. o129 = Instance.new("ObjectValue")
  138. o130 = Instance.new("RemoteFunction")
  139. o131 = Instance.new("RemoteFunction")
  140. o132 = Instance.new("RemoteFunction")
  141. o133 = Instance.new("RemoteEvent")
  142. o134 = Instance.new("RemoteFunction")
  143. o135 = Instance.new("RemoteFunction")
  144. o136 = Instance.new("RemoteFunction")
  145. o137 = Instance.new("LocalScript")
  146. o138 = Instance.new("IntValue")
  147. o139 = Instance.new("RemoteEvent")
  148. o140 = Instance.new("RemoteEvent")
  149. o141 = Instance.new("RemoteEvent")
  150. o142 = Instance.new("RemoteEvent")
  151. o146 = Instance.new("Part")
  152. o147 = Instance.new("ParticleEmitter")
  153. o148 = Instance.new("ParticleEmitter")
  154. o149 = Instance.new("PointLight")
  155. o1.Parent = mas
  156. o2.Name = "Regen Button"
  157. o2.Parent = o1
  158. o2.Material = Enum.Material.CorrodedMetal
  159. o2.BrickColor = BrickColor.new("Deep blue")
  160. o2.Position = Vector3.new(-146.5, 1.20001495, 38.5)
  161. o2.Rotation = Vector3.new(0, -90, 0)
  162. o2.Anchored = true
  163. o2.FormFactor = Enum.FormFactor.Plate
  164. o2.Size = Vector3.new(5, 2.4000001, 1)
  165. o2.CFrame = CFrame.new(-146.5, 1.20001495, 38.5, 0, 0, -1, 0, 1, -0, 1, 0, -0)
  166. o2.TopSurface = Enum.SurfaceType.Smooth
  167. o2.Color = Color3.new(0.129412, 0.329412, 0.72549)
  168. o2.Position = Vector3.new(-146.5, 1.20001495, 38.5)
  169. o2.Orientation = Vector3.new(0, -90, 0)
  170. o2.Color = Color3.new(0.129412, 0.329412, 0.72549)
  171. o3.Name = "Regen"
  172. o3.Parent = o2
  173. table.insert(cors,coroutine.create(function()
  174. wait()
  175. runDummyScript(function()
  176. --Do not change anything besides the lines mentioned below.
  177.  
  178. model = script.Parent.Parent--Indicates that the script interacts with the model the button is grouped with.
  179. messageText = ""--If you want a message to appear upon pressing, type it here.
  180.  
  181. message = Instance.new("Message")
  182. message.Text = messageText
  183. backup = model:clone()
  184. enabled = true
  185.  
  186. function regenerate()
  187. message.Parent = game.Workspace
  188. model:remove()
  189.  
  190. wait(2)--Change this number to display the regen message as long as you want in seconds.
  191.  
  192. model = backup:clone()
  193. model.Parent = game.Workspace
  194. model:makeJoints()
  195. message.Parent = nil
  196.  
  197. script.Disabled = true
  198. script.Parent.BrickColor = BrickColor.new(69)
  199. wait(10)--Change this number to change the time in between regenerations via the button, in seconds..
  200. script.Parent.BrickColor = BrickColor.new(197)
  201. script.Disabled = false
  202. end
  203.  
  204. function onHit(hit)
  205. if (hit.Parent:FindFirstChild("Humanoid") ~= nil) and enabled then
  206. regenerate()
  207. end
  208. end
  209.  
  210. script.Parent.Touched:connect(onHit)
  211.  
  212. --And it's done.
  213. end,o3)
  214. end))
  215. o4.Parent = o2
  216. o7.Name = "Regen Button-to-Smooth Block Model Strong Joint"
  217. o7.Parent = o2
  218. o7.C0 = CFrame.new(2.5, -1.20000005, -0.5, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  219. o7.C1 = CFrame.new(2, -1.20001221, -2.5, 0, -0, -1, 0, 1, 0, 1, -0, -0)
  220. o7.Part0 = o2
  221. o7.Part1 = mas
  222. o8.Parent = o1
  223. o9.Name = "Ambassador"
  224. o9.Parent = o8
  225. o10.Name = "clientMain"
  226. o10.Parent = o9
  227. table.insert(cors,coroutine.create(function()
  228. wait()
  229. runDummyScript(function()
  230. --[[
  231. Kit By TurboFusion
  232. Remake By MuYhEt & Xander521
  233. --]]
  234. --------------------------------------------------------------------------------------
  235. --------------------[ CHARACTER LOADING ]---------------------------------------------
  236. --------------------------------------------------------------------------------------
  237.  
  238. repeat wait() until game.Players.LocalPlayer.Character
  239. repeat wait() until game.Players.LocalPlayer.Character:IsDescendantOf(game.Workspace)
  240. wait(1 / 20)
  241.  
  242. --------------------------------------------------------------------------------------
  243. --------------------[ IGNORE MODEL ]--------------------------------------------------
  244. --------------------------------------------------------------------------------------
  245.  
  246. local ignoreCode = script:WaitForChild("ignoreCode")
  247.  
  248. repeat wait() until ignoreCode.Value ~= 0
  249.  
  250. local ignoreModel = game.Workspace:WaitForChild("ignoreModel_"..ignoreCode.Value)
  251.  
  252. local grenadeFolder = ignoreModel:WaitForChild("grenadeFolder")
  253.  
  254. --------------------------------------------------------------------------------------
  255. --------------------[ CONSTANTS ]-----------------------------------------------------
  256. --------------------------------------------------------------------------------------
  257.  
  258. local Gun = script.Parent
  259. local serverMain = Gun:WaitForChild("serverMain")
  260. local Handle = Gun:WaitForChild("Handle")
  261. local AimPart = Gun:WaitForChild("AimPart")
  262. local Main = Gun:WaitForChild("Main")
  263.  
  264. local Ammo = Gun:WaitForChild("Ammo")
  265. local ClipSize = Gun:WaitForChild("ClipSize")
  266. local StoredAmmo = Gun:WaitForChild("StoredAmmo")
  267.  
  268. local createTweenIndicator = serverMain:WaitForChild("createTweenIndicator")
  269. local deleteTweenIndicator = serverMain:WaitForChild("deleteTweenIndicator")
  270. local getWeldCF = serverMain:WaitForChild("getWeldCF")
  271. local gunSetup = serverMain:WaitForChild("gunSetup")
  272. local lerpCF = serverMain:WaitForChild("lerpCF")
  273. local createBlood = serverMain:WaitForChild("createBlood")
  274. local createBulletImpact = serverMain:WaitForChild("createBulletImpact")
  275. local createShockwave = serverMain:WaitForChild("createShockwave")
  276. local createTrail = serverMain:WaitForChild("createTrail")
  277.  
  278. local Particle = require(script:WaitForChild("Particle"))
  279. local Spring = require(script:WaitForChild("Spring"))
  280. local Anims = require(Gun:WaitForChild("ANIMATIONS"))
  281. local Plugins = require(Gun:WaitForChild("PLUGINS"))
  282. local S = require(Gun:WaitForChild("SETTINGS"))
  283.  
  284. local Player = game.Players.LocalPlayer
  285. local Char = Player.Character
  286. local Humanoid = Char:WaitForChild("Humanoid")
  287. local Torso = Char:WaitForChild("Torso")
  288. local Head = Char:WaitForChild("Head")
  289. local HRP = Char:WaitForChild("HumanoidRootPart")
  290. local Root = HRP:WaitForChild("RootJoint")
  291.  
  292. local Neck = Torso:WaitForChild("Neck")
  293.  
  294. local LArm = Char:WaitForChild("Left Arm")
  295. local RArm = Char:WaitForChild("Right Arm")
  296. local LLeg = Char:WaitForChild("Left Leg")
  297. local RLeg = Char:WaitForChild("Right Leg")
  298.  
  299. local M2 = Player:GetMouse()
  300.  
  301. local mainGUI = script:WaitForChild("mainGUI")
  302.  
  303. local crossHair = mainGUI:WaitForChild("crossHair")
  304. local HUD = mainGUI:WaitForChild("HUD")
  305. local Scope = mainGUI:WaitForChild("Scope")
  306. local fireSelect = mainGUI:WaitForChild("fireSelect")
  307. local hitMarker = mainGUI:WaitForChild("hitMarker")
  308. local Sens = mainGUI:WaitForChild("Sens")
  309.  
  310. local crossA = crossHair:WaitForChild("A"):WaitForChild("Line")
  311. local crossB = crossHair:WaitForChild("B"):WaitForChild("Line")
  312. local crossC = crossHair:WaitForChild("C"):WaitForChild("Line")
  313. local crossD = crossHair:WaitForChild("D"):WaitForChild("Line")
  314.  
  315. local Controls = HUD:WaitForChild("Controls")
  316.  
  317. local gunNameTitle = HUD:WaitForChild("gunName"):WaitForChild("Title")
  318.  
  319. local scopeMain = Scope:WaitForChild("Main")
  320. local scopeSteady = Scope:WaitForChild("Steady")
  321.  
  322. local fireModes = fireSelect:WaitForChild("Modes")
  323.  
  324. local modeGUI = HUD:WaitForChild("Mode"):WaitForChild("Main")
  325. local clipAmmoGUI = HUD:WaitForChild("Ammo"):WaitForChild("Clip")
  326. local storedAmmoGUI = HUD:WaitForChild("Ammo"):WaitForChild("Stored")
  327.  
  328. local DS = game:GetService("Debris")
  329. local CP = game:GetService("ContentProvider")
  330. local RS = game:GetService("RunService")
  331. local UIS = game:GetService("UserInputService")
  332.  
  333. local Cam = game.Workspace.CurrentCamera
  334.  
  335. local ABS, HUGE, FLOOR, CEIL = math.abs, math.huge, math.floor, math.ceil
  336. local RAD, SIN, COS, TAN = math.rad, math.sin, math.cos, math.tan
  337. local VEC2, V3 = Vector2.new, Vector3.new
  338. local CF, CFANG = CFrame.new, CFrame.Angles
  339. local INSERT = table.insert
  340.  
  341. local maxStamina = S.sprintTime * 60
  342. local maxSteadyTime = S.scopeSettings.steadyTime * 60
  343.  
  344. local LethalIcons = {
  345. "http://www.roblox.com/asset/?id=194849880";
  346. "http://www.roblox.com/asset/?id=195727791";
  347. "http://www.roblox.com/asset/?id=195728137";
  348. "http://www.roblox.com/asset/?id=218151830";
  349. }
  350.  
  351. local TacticalIcons = {
  352. "http://www.roblox.com/asset/?id=195728473";
  353. "http://www.roblox.com/asset/?id=195728693";
  354. }
  355.  
  356. local ASCII = {
  357. 071; 117; 110; 032;
  358. 075; 105; 116; 032;
  359. 115; 099; 114; 105;
  360. 112; 116; 101; 100;
  361. 032; 098; 121; 032;
  362. 084; 117; 114; 098;
  363. 111; 070; 117; 115;
  364. 105; 111; 110; 000;
  365. }
  366.  
  367. local Ignore = {
  368. Char;
  369. ignoreModel;
  370. }
  371.  
  372. local Shoulders = {
  373. Right = Torso:WaitForChild("Right Shoulder");
  374. Left = Torso:WaitForChild("Left Shoulder")
  375. }
  376.  
  377. local armC0 = {
  378. CF(-1.5, 0, 0) * CFANG(RAD(90), 0, 0);
  379. CF(1.5, 0, 0) * CFANG(RAD(90), 0, 0);
  380. }
  381.  
  382. local legC0 = {
  383. Stand = {
  384. CF(-0.5, -2, 0);
  385. CF(0.5, -2, 0);
  386. };
  387. Crouch = {
  388. CF(-0.5, -1.5, 0.5) * CFANG(-RAD(90), 0, 0);
  389. CF(0.5, -1, -0.75);
  390. };
  391. Prone = {
  392. CF(-0.5, -2, 0);
  393. CF(0.5, -2, 0);
  394. };
  395. }
  396.  
  397. local Sine = function(X)
  398. return SIN(RAD(X))
  399. end
  400.  
  401. local Linear = function(X)
  402. return (X / 90)
  403. end
  404.  
  405. --------------------------------------------------------------------------------------
  406. --------------------[ VARIABLES ]-----------------------------------------------------
  407. --------------------------------------------------------------------------------------
  408.  
  409. local Selected = false
  410.  
  411. local playerMass = 0
  412.  
  413. local Forward = false
  414. local Backward = false
  415.  
  416. local Idling = false
  417. local Walking = false
  418. local Running = false
  419.  
  420. local crawlCamRot = 0
  421. local crawlAlpha = 0
  422. local idleAlpha = 1
  423. local walkAlpha = 0
  424. local isCrawling = false
  425. local isIdling = false
  426. local isWalking = false
  427. local isRunning = false
  428.  
  429. local Aimed = false
  430. local Aiming = false
  431. local aimAlpha = 0
  432. local headOffset = VEC2(COS(RAD(90) - S.aimSettings.headTilt) * 0.5, 1 + SIN(RAD(90) - S.aimSettings.headTilt) * 0.5)
  433.  
  434. local Reloading = false
  435. local breakReload = false
  436. local magVisible = true
  437. local newMag = false
  438.  
  439. local Knifing = false
  440.  
  441. local MB1Down = false
  442. local Firing = false
  443. local canFire = true
  444. local fireFunction = nil
  445. local firstShot = false
  446. local shotCount = 0
  447. local lastSideRecoil = {0, 0}
  448. local recoilAnim = {
  449. Pos = V3();
  450. Rot = V3();
  451. Code = nil;
  452. }
  453.  
  454. local numModes = 0
  455. local rawFireMode = 1
  456. local canSelectFire = true
  457. local guiAngOffset = 0
  458. local Modes = {}
  459.  
  460. local onGround = true
  461. local startFallHeight = 0
  462. local jumpAnim = {
  463. Pos = 0;
  464. Rot = 0;
  465. Code = 0;
  466. }
  467.  
  468. local runReady = true
  469. local runKeyPressed = false
  470. local chargingStamina = false
  471.  
  472. local AimingIn = false
  473. local AimingOut = false
  474.  
  475. local Stamina = S.sprintTime * 60
  476. local currentSteadyTime = S.scopeSettings.steadyTime * 60
  477.  
  478. local camSteady = false
  479. local takingBreath = false
  480. local steadyKeyPressed = false
  481.  
  482. local Grip = nil
  483. local aimedGripCF = nil
  484.  
  485. local spreadZoom = "unAimed"
  486. local spreadStance = "Stand"
  487. local spreadMotion = "Idling"
  488. local baseSpread = S.spreadSettings.unAimed.Stand.Idling
  489. local currentSpread = 0
  490. local loweringSpread = false
  491.  
  492. local mouseSensitivity = S.sensitivitySettings.Default
  493. local aimSensitivity = S.sensitivitySettings.Aim
  494. local lastSensUpdate = 0
  495.  
  496. local ammoInClip = 0
  497.  
  498. local Stance = 0
  499. local stanceSway = 1
  500. local camSway = 1
  501.  
  502. local camAng = VEC2()
  503.  
  504. local armTilt = 0
  505. local moveAng = 0
  506. local animCode = 0
  507.  
  508. local desiredXOffset = 0
  509. local desiredYOffset = 0
  510. local currentXOffset = 0
  511. local currentYOffset = 0
  512. local aimHeadOffset = 0
  513. local recoilAnimMultiplier = 1
  514. local jumpAnimMultiplier = 1
  515. local translationDivisor = 7
  516. local rotationMultiplier = S.momentumSettings.Amplitude.unAimed
  517. local armTiltMultiplier = 1
  518.  
  519. local equipAnimPlaying = false
  520.  
  521. local crossOffset = 0
  522.  
  523. local camOffsets = {
  524. guiScope = {
  525. Rot = V3();
  526. };
  527. Reload = {
  528. Rot = V3();
  529. Code = nil;
  530. };
  531. Recoil = {
  532. Rot = V3();
  533. Code = nil;
  534. };
  535. }
  536.  
  537. local Anim = {
  538. Pos = V3();
  539. Rot = V3();
  540. Ang = 0;
  541. Code = 0;
  542. }
  543.  
  544. local lastBeat = 0
  545.  
  546. local gunParts = {}
  547.  
  548. local Connections = {}
  549.  
  550. local Keys = {}
  551.  
  552. --------------------------------------------------------------------------------------
  553. --------------------[ PRE-LOADING ]---------------------------------------------------
  554. --------------------------------------------------------------------------------------
  555.  
  556. CP:Preload(S.explosionSettings.soundId)
  557. CP:Preload(S.holeSettings.Texture)
  558. CP:Preload(S.sparkSettings.Texture)
  559. CP:Preload(S.smokeSettings.Texture)
  560. CP:Preload(S.bloodSettings.Texture)
  561. CP:Preload("http://www.roblox.com/asset/?id=126877530") --The dark green arrow in the select fire gui
  562. CP:Preload("http://www.roblox.com/asset/?id=55754953") --The circle in the select fire gui
  563.  
  564. --------------------------------------------------------------------------------------
  565. --------------------[ GUN SETUP ]-----------------------------------------------------
  566. --------------------------------------------------------------------------------------
  567.  
  568. serverMain:WaitForChild("Plyr").Value = Player
  569.  
  570. local gunMomentum = Spring.new(V3())
  571. gunMomentum.s = S.momentumSettings.Speed
  572. gunMomentum.d = S.momentumSettings.Damper
  573.  
  574. local gunRecoilSpring = Spring.new(V3())
  575. gunRecoilSpring.s = S.recoilSettings.springSpeed
  576. gunRecoilSpring.d = S.recoilSettings.springDamper
  577.  
  578. local camRecoilSpring = Spring.new(V3())
  579. camRecoilSpring.s = 35
  580. camRecoilSpring.d = 0.5
  581.  
  582. local crossSpring = Spring.new(V3(crossOffset + (baseSpread + currentSpread) * 50, 0, 0))
  583. crossSpring.s = 20
  584. crossSpring.d = 0.75
  585.  
  586. --[[local function getModelMass(P)
  587. for _, v in pairs(P:GetChildren()) do
  588. if v:IsA("BasePart") then
  589. playerMass = playerMass + v:GetMass()
  590. end
  591. getModelMass(v)
  592. end
  593. end
  594. getModelMass(Char)
  595.  
  596. Char.DescendantAdded:connect(function(Descendant)
  597. if Descendant:IsA("BasePart") then
  598. playerMass = playerMass + Descendant:GetMass()
  599. end
  600. end)
  601. Char.DescendantRemoving:connect(function(Descendant)
  602. if Descendant:IsA("BasePart") then
  603. playerMass = playerMass - Descendant:GetMass()
  604. end
  605. end)]]
  606.  
  607. --------------------------------------------------------------------------------------
  608. --------------------[ WELD CFRAMES ]--------------------------------------------------
  609. --------------------------------------------------------------------------------------
  610.  
  611. spawn(function()
  612. --[[for _, v in pairs(Gun:GetChildren()) do
  613. if v:IsA("BasePart") and v ~= Handle then
  614. if v:FindFirstChild("mainWeld") then v.mainWeld:Destroy() end
  615. if (not v:FindFirstChild("weldCF")) then
  616. local weldCF = Instance.new("CFrameValue")
  617. weldCF.Name = "weldCF"
  618. weldCF.Value = Handle.CFrame:toObjectSpace(v.CFrame)
  619. weldCF.Parent = v
  620. INSERT(gunParts, {Obj = v, Weld = nil})
  621. end
  622. if string.sub(v.Name, 1, 3) == "Mag" then
  623. if (not v:FindFirstChild("magTrans")) then
  624. local magTrans = Instance.new("NumberValue")
  625. magTrans.Name = "magTrans"
  626. magTrans.Value = v.Transparency
  627. magTrans.Parent = v
  628. end
  629. end
  630. v.Anchored = false
  631. end
  632. end
  633. Handle.Anchored = false]]
  634. for _, v in pairs(Gun:GetChildren()) do
  635. if v:FindFirstChild("weldCF") then
  636. INSERT(gunParts, {Obj = v, Weld = nil})
  637. v.Anchored = false
  638. end
  639. end
  640. end)
  641.  
  642. --------------------------------------------------------------------------------------
  643. --------------------[ MAIN PROGRAM ]--------------------------------------------------
  644. --------------------------------------------------------------------------------------
  645.  
  646. --------------------[ ARM CREATION FUNCTION ]-----------------------------------------
  647.  
  648. function createArms()
  649. local Arms = {}
  650. for i = 0, 1 do
  651. local armModel = Instance.new("Model")
  652. armModel.Name = "armModel"
  653.  
  654. local Arm = Instance.new("Part")
  655. Arm.BrickColor = (S.fakeArmSettings.realBodyColor and (i == 0 and LArm.BrickColor or RArm.BrickColor) or S.fakeArmSettings.Color)
  656. Arm.Transparency = S.fakeArmSettings.Transparency
  657. Arm.Name = "Arm"
  658. Arm.CanCollide = false
  659. Arm.Size = V3(0.598, 2, 0.598)
  660. Arm.Parent = armModel
  661. local armMesh = Instance.new("SpecialMesh")
  662. armMesh.MeshId = "rbxasset://fonts//leftarm.mesh"
  663. armMesh.MeshType = Enum.MeshType.FileMesh
  664. armMesh.Scale = V3(0.598, 1, 0.598)
  665. armMesh.Parent = Arm
  666.  
  667. local Glove1 = Instance.new("Part")
  668. Glove1.BrickColor = BrickColor.new("Black")
  669. Glove1.Name = "Glove1"
  670. Glove1.CanCollide = false
  671. Glove1.Size = V3(0.598, 2, 0.598)
  672. Glove1.Parent = armModel
  673. local glove1Mesh = Instance.new("SpecialMesh")
  674. glove1Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
  675. glove1Mesh.Offset = V3(0, -0.5, 0)
  676. glove1Mesh.Scale = V3(0.658, 0.205, 0.658)
  677. glove1Mesh.Parent = Glove1
  678. local glove1Weld = Instance.new("Weld")
  679. glove1Weld.Part0 = Arm
  680. glove1Weld.Part1 = Glove1
  681. glove1Weld.Parent = Arm
  682.  
  683. local Glove2 = Instance.new("Part")
  684. Glove2.BrickColor = BrickColor.new("Black")
  685. Glove2.Name = "Glove2"
  686. Glove2.CanCollide = false
  687. Glove2.Size = V3(0.598, 2, 0.598)
  688. Glove2.Parent = armModel
  689. local glove2Mesh = Instance.new("SpecialMesh")
  690. glove2Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
  691. glove2Mesh.Offset = V3(0, -0.435, 0)
  692. glove2Mesh.Scale = V3(0.69, 0.105, 0.69)
  693. glove2Mesh.Parent = Glove2
  694. local glove2Weld = Instance.new("Weld")
  695. glove2Weld.Part0 = Arm
  696. glove2Weld.Part1 = Glove2
  697. glove2Weld.Parent = Arm
  698.  
  699. local Glove3 = Instance.new("Part")
  700. Glove3.BrickColor = BrickColor.new("Black")
  701. Glove3.Name = "Glove3"
  702. Glove3.CanCollide = false
  703. Glove3.Size = V3(0.598, 2, 0.598)
  704. Glove3.Parent = armModel
  705. local glove3Mesh = Instance.new("SpecialMesh")
  706. glove3Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
  707. glove3Mesh.Offset = V3(0.18 * ((i * 2) - 1), -0.7, 0)
  708. glove3Mesh.Scale = V3(0.299, 0.305, 0.657)
  709. glove3Mesh.Parent = Glove3
  710. local glove3Weld = Instance.new("Weld")
  711. glove3Weld.Part0 = Arm
  712. glove3Weld.Part1 = Glove3
  713. glove3Weld.Parent = Arm
  714.  
  715. local Sleeve1 = Instance.new("Part")
  716. Sleeve1.BrickColor = BrickColor.new("Sand green")
  717. Sleeve1.Name = "Sleeve1"
  718. Sleeve1.CanCollide = false
  719. Sleeve1.Size = V3(0.598, 2, 0.598)
  720. Sleeve1.Parent = armModel
  721. local sleeve1Mesh = Instance.new("SpecialMesh")
  722. sleeve1Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
  723. sleeve1Mesh.Offset = V3(0, 0.75, 0)
  724. sleeve1Mesh.Scale = V3(0.656, 0.3, 0.656)
  725. sleeve1Mesh.Parent = Sleeve1
  726. local sleeve1Weld = Instance.new("Weld")
  727. sleeve1Weld.Part0 = Arm
  728. sleeve1Weld.Part1 = Sleeve1
  729. sleeve1Weld.Parent = Arm
  730.  
  731. local Sleeve2 = Instance.new("Part")
  732. Sleeve2.BrickColor = BrickColor.new("Sand green")
  733. Sleeve2.Name = "Sleeve2"
  734. Sleeve2.CanCollide = false
  735. Sleeve2.Size = V3(0.598, 2, 0.598)
  736. Sleeve2.Parent = armModel
  737. local sleeve2Mesh = Instance.new("SpecialMesh")
  738. sleeve2Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
  739. sleeve2Mesh.Offset = V3(0, 0.55, 0)
  740. sleeve2Mesh.Scale = V3(0.75, 0.1, 0.75)
  741. sleeve2Mesh.Parent = Sleeve2
  742. local sleeve2Weld = Instance.new("Weld")
  743. sleeve2Weld.Part0 = Arm
  744. sleeve2Weld.Part1 = Sleeve2
  745. sleeve2Weld.Parent = Arm
  746.  
  747. table.insert(Arms, {Model = armModel, armPart = Arm})
  748. end
  749. return Arms
  750. end
  751.  
  752. --------------------[ MATH FUNCTIONS ]------------------------------------------------
  753.  
  754. function Map(Val, fromLow, fromHigh, toLow, toHigh)
  755. return (Val - fromLow) * (toHigh - toLow) / (fromHigh - fromLow) + toLow
  756. end
  757.  
  758. function numLerp(A, B, Alpha)
  759. return A + (B - A) * Alpha
  760. end
  761.  
  762. function RAND(Min, Max, Accuracy)
  763. return numLerp(Min, Max, math.random())
  764. --[[local Inverse = 1 / (Accuracy or 1)
  765. return (math.random(Min * Inverse, Max * Inverse) / Inverse)]]
  766. end
  767.  
  768. function Round(Num, toNearest)
  769. return math.floor(Num / toNearest + 0.5) * toNearest
  770. end
  771.  
  772. function getNearestPoint(A, B, Origin)
  773. local A2 = (A - Origin).magnitude
  774. local B2 = (B - Origin).magnitude
  775. return (math.min(A2, B2) == A2 and A or B)
  776. end
  777.  
  778. --------------------[ TWEEN FUNCTIONS ]-----------------------------------------------
  779.  
  780. function tweenJoint(Joint, newC0, newC1, Alpha, Duration)
  781. spawn(function()
  782. local newCode = math.random(-1e9, 1e9) --This creates a random code between -1000000000 and 1000000000
  783. local tweenIndicator = nil
  784. if (not Joint:findFirstChild("tweenCode")) then --If the joint isn't being tweened, then
  785. tweenIndicator = Instance.new("IntValue")
  786. tweenIndicator.Name = "tweenCode"
  787. tweenIndicator.Value = newCode
  788. tweenIndicator.Parent = Joint
  789. else
  790. tweenIndicator = Joint.tweenCode
  791. tweenIndicator.Value = newCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
  792. end
  793. --local tweenIndicator = createTweenIndicator:InvokeServer(Joint, newCode)
  794. if Duration <= 0 then --If the duration is less than or equal to 0 then there's no need for a tweening loop
  795. if newC0 then Joint.C0 = newC0 end
  796. if newC1 then Joint.C1 = newC1 end
  797. else
  798. local startC0 = Joint.C0
  799. local startC1 = Joint.C1
  800. local t0 = tick()
  801. while true do
  802. RS.RenderStepped:wait() --This makes the for loop step every 1/60th of a second
  803. local X = math.min((tick() - t0) / Duration, 1) * 90
  804. if tweenIndicator.Value ~= newCode then break end --This makes sure that another tween wasn't called on the same joint
  805. if (not Selected) then break end --This stops the tween if the tool is deselected
  806. if newC0 then Joint.C0 = startC0:lerp(newC0, Alpha(X)) end
  807. if newC1 then Joint.C1 = startC1:lerp(newC1, Alpha(X)) end
  808. --if newC0 then lerpCF:InvokeServer(Joint, "C0", startC0, newC0, Alpha(X)) end
  809. --if newC1 then lerpCF:InvokeServer(Joint, "C1", startC1, newC1, Alpha(X)) end
  810. if X == 90 then break end
  811. end
  812. end
  813. if tweenIndicator.Value == newCode then --If this tween functions was the last one called on a joint then it will remove the code
  814. tweenIndicator:Destroy()
  815. end
  816. --deleteTweenIndicator:InvokeServer(tweenIndicator, newCode)
  817. end)
  818. end
  819.  
  820. function tweenCam(Key, newRot, Alpha, Duration)
  821. spawn(function()
  822. local newCode = math.random(-1e9, 1e9)
  823. camOffsets[Key].Code = newCode
  824.  
  825. local Increment = 1.5 / Duration
  826. local prevRot = camOffsets[Key].Rot
  827. local X = 0
  828. while true do
  829. RS.RenderStepped:wait()
  830. local newX = X + Increment
  831. X = (newX > 90 and 90 or newX)
  832. if camOffsets[Key].Code ~= newCode then break end
  833. if (not Selected) then break end
  834.  
  835. camOffsets[Key].Rot = prevRot:lerp(newRot, Alpha(X))
  836.  
  837. if X == 90 then break end
  838. end
  839.  
  840. if camOffsets[Key].Code == newCode then
  841. camOffsets[Key].Code = nil
  842. end
  843. end)
  844. end
  845.  
  846. function tweenRecoil(newPos, newRot, Alpha, Duration)
  847. spawn(function()
  848. local newCode = math.random(-1e9, 1e9)
  849. recoilAnim.Code = newCode
  850.  
  851. local Increment = 1.5 / Duration
  852. local prevPos = recoilAnim.Pos
  853. local prevRot = recoilAnim.Rot
  854. local X = 0
  855. while true do
  856. RS.RenderStepped:wait()
  857. local newX = X + Increment
  858. X = (newX > 90 and 90 or newX)
  859. if recoilAnim.Code ~= newCode then break end
  860. if (not Selected) then break end
  861.  
  862. recoilAnim.Pos = prevPos:lerp(newPos, Alpha(X))
  863. recoilAnim.Rot = prevRot:lerp(newRot, Alpha(X))
  864.  
  865. if X == 90 then break end
  866. end
  867.  
  868. if recoilAnim.Code == newCode then
  869. recoilAnim.Code = nil
  870. end
  871. end)
  872. end
  873.  
  874. --------------------[ GUI UPDATE FUNCTIONS ]------------------------------------------
  875.  
  876. local function updateClipAmmo()
  877. clipAmmoGUI.Text = Ammo.Value
  878. clipAmmoGUI.TextColor3 = (Ammo.Value <= (ClipSize.Value / 3) and Color3.new(1, 0, 0) or Color3.new(1, 1, 1))
  879. end
  880.  
  881. local function updateStoredAmmo()
  882. storedAmmoGUI.Text = StoredAmmo.Value
  883. storedAmmoGUI.TextColor3 = (StoredAmmo.Value <= (ClipSize.Value * 2) and Color3.new(1, 0, 0) or Color3.new(1, 1, 1))
  884. end
  885.  
  886. local function updateHealth()
  887. HUD.Health.Num.Text = CEIL(Humanoid.Health).."%"
  888. HUD.Health.Num.TextColor3 = (
  889. (Humanoid.Health > 200 / 3) and Color3.new(1, 1, 1) or
  890. (Humanoid.Health <= 200 / 3 and Humanoid.Health > 100 / 3) and Color3.new(1, 1, 0) or
  891. (Humanoid.Health <= 100 / 3) and Color3.new(1, 0, 0)
  892. )
  893. end
  894.  
  895. local function updateModeLabels(prevState, newState, X)
  896. for Num, Mode in pairs(fireModes:GetChildren()) do
  897. local guiAngOffset2 = guiAngOffset + 90
  898. local Ang = numLerp(
  899. (guiAngOffset2 * prevState) - (guiAngOffset2 * Num) - guiAngOffset2,
  900. (guiAngOffset2 * newState) - (guiAngOffset2 * Num) - guiAngOffset2,
  901. Sine(X)
  902. ) + guiAngOffset
  903. local XPos = COS(RAD(Ang))
  904. local YPos = SIN(RAD(Ang))
  905. Mode.Position = UDim2.new(0.5, XPos * 100, 0.5, YPos * 100)
  906.  
  907. local R = COS(math.atan2(Mode.Position.Y.Offset, Mode.Position.X.Offset) + RAD(90))
  908. Mode.Label.TextTransparency = 1 - ((R / 4) + 0.75)
  909.  
  910. local Scale = (R * 10) + 50
  911. Mode.Label.Position = UDim2.new(0, -Scale / 2, 0, 0)
  912. Mode.Label.Size = UDim2.new(0, Scale, 0, Scale / 2)
  913. end
  914. end
  915.  
  916. --------------------[ GUI SETUP FUNCTION ]--------------------------------------------
  917.  
  918. function convertKey(Key)
  919. if Key == string.char(8) then
  920. return "BKSPCE"
  921. elseif Key == string.char(9) then
  922. return "TAB"
  923. elseif Key == string.char(13) then
  924. return "ENTER"
  925. elseif Key == string.char(17) then
  926. return "UP"
  927. elseif Key == string.char(18) then
  928. return "DOWN"
  929. elseif Key == string.char(19) then
  930. return "RIGHT"
  931. elseif Key == string.char(20) then
  932. return "LEFT"
  933. elseif Key == string.char(22) then
  934. return "HOME"
  935. elseif Key == string.char(23) then
  936. return "END"
  937. elseif Key == string.char(27) then
  938. return "F2"
  939. elseif Key == string.char(29) then
  940. return "F4"
  941. elseif Key == string.char(30) then
  942. return "F5"
  943. elseif Key == string.char(32) or Key == " " then
  944. return "F7"
  945. elseif Key == string.char(33) or Key == "!" then
  946. return "F8"
  947. elseif Key == string.char(34) or Key == '"' then
  948. return "F9"
  949. elseif Key == string.char(35) or Key == "#" then
  950. return "F10"
  951. elseif Key == string.char(37) or Key == "%" then
  952. return "F12"
  953. elseif Key == string.char(47) or Key == "/" then
  954. return "R-SHIFT"
  955. elseif Key == string.char(48) or Key == "0" then
  956. return "L-SHIFT"
  957. elseif Key == string.char(49) or Key == "1" then
  958. return "R-CTRL"
  959. elseif Key == string.char(50) or Key == "2" then
  960. return "L-CTRL"
  961. elseif Key == string.char(51) or Key == "3" then
  962. return "R-ALT"
  963. elseif Key == string.char(52) or Key == "4" then
  964. return "L-ALT"
  965. else
  966. return string.upper(Key)
  967. end
  968. end
  969.  
  970. function createControlFrame(Key, Desc, Num)
  971. local C = Instance.new("Frame")
  972. C.BackgroundTransparency = ((Num % 2) == 1 and 0.7 or 1)
  973. C.BorderSizePixel = 0
  974. C.Name = "C"..Num
  975. C.Position = UDim2.new(0, 0, 0, Num * 20)
  976. C.Size = UDim2.new(1, 0, 0, 20)
  977. C.ZIndex = 10
  978.  
  979. local K = Instance.new("TextLabel")
  980. K.BackgroundTransparency = 1
  981. K.Name = "Key"
  982. K.Size = UDim2.new(0, 45, 1, 0)
  983. K.ZIndex = 10
  984. K.Font = Enum.Font.ArialBold
  985. K.FontSize = Enum.FontSize.Size14
  986. K.Text = Key
  987. K.TextColor3 = Color3.new(1, 1, 1)
  988. K.TextScaled = (string.len(Key) > 5)
  989. K.TextWrapped = (string.len(Key) > 5)
  990. K.Parent = C
  991.  
  992. local D = Instance.new("TextLabel")
  993. D.BackgroundTransparency = 1
  994. D.Name = "Desc"
  995. D.Position = UDim2.new(0, 50, 0, 0)
  996. D.Size = UDim2.new(1, -50, 1, 0)
  997. D.ZIndex = 10
  998. D.Font = Enum.Font.SourceSansBold
  999. D.FontSize = Enum.FontSize.Size14
  1000. D.Text = "- "..Desc
  1001. D.TextColor3 = Color3.new(1, 1, 1)
  1002. D.TextXAlignment = Enum.TextXAlignment.Left
  1003. D.Parent = C
  1004.  
  1005. C.Parent = Controls
  1006. end
  1007.  
  1008. function createModes()
  1009. numModes = 0
  1010. for i, v in pairs(S.selectFireSettings.Modes) do
  1011. if v then
  1012. numModes = numModes + 1
  1013. end
  1014. end
  1015.  
  1016. local currentMode = 0
  1017. for i, v in pairs(S.selectFireSettings.Modes) do
  1018. if v then
  1019. local Frame = Instance.new("Frame")
  1020. Frame.BackgroundTransparency = 1
  1021. Frame.Name = currentMode
  1022. Frame.Position = UDim2.new()
  1023. Frame.Size = UDim2.new()
  1024. Frame.Parent = fireModes
  1025. local modeLabel = Instance.new("TextLabel")
  1026. modeLabel.BackgroundTransparency = 1
  1027. modeLabel.Name = "Label"
  1028. modeLabel.Position = UDim2.new(0, -20, 0, 0)
  1029. modeLabel.Size = UDim2.new(0, 40, 0, 20)
  1030. modeLabel.Font = Enum.Font.SourceSansBold
  1031. modeLabel.FontSize = Enum.FontSize.Size18
  1032. modeLabel.Text = string.upper(i)
  1033. modeLabel.TextColor3 = Color3.new(1, 1, 1)
  1034. modeLabel.TextScaled = true
  1035. modeLabel.TextStrokeTransparency = 0
  1036. modeLabel.TextTransparency = 0.5
  1037. modeLabel.TextWrapped = true
  1038. modeLabel.Parent = Frame
  1039. table.insert(Modes, string.upper(i))
  1040. currentMode = currentMode + 1
  1041. end
  1042. end
  1043.  
  1044. guiAngOffset = -15 * (numModes ^ 3) + 150 * (numModes ^ 2) - 525 * numModes + 660
  1045. end
  1046.  
  1047. function setUpGUI()
  1048. local currentNum = 1
  1049.  
  1050. for _, v in pairs(Controls:GetChildren()) do
  1051. if v.Name ~= "Title" then
  1052. v:Destroy()
  1053. end
  1054. end
  1055.  
  1056. for _, PTable in pairs(Plugins.KeyDown) do
  1057. createControlFrame(convertKey(PTable.Key), PTable.Description, currentNum)
  1058. currentNum = currentNum + 1
  1059. end
  1060.  
  1061. if S.canChangeStance then
  1062. local Dive = (S.dolphinDive and " / Dive" or "")
  1063. createControlFrame(convertKey(S.Keys.lowerStance), "Lower Stance"..Dive, currentNum)
  1064. currentNum = currentNum + 1
  1065.  
  1066. createControlFrame(convertKey(S.Keys.raiseStance), "Raise Stance", currentNum)
  1067. currentNum = currentNum + 1
  1068. end
  1069.  
  1070. if S.selectFire then
  1071. createControlFrame(convertKey(S.Keys.selectFire), "Select Fire", currentNum)
  1072. currentNum = currentNum + 1
  1073. end
  1074.  
  1075. createControlFrame(convertKey(S.Keys.Reload), "Reload", currentNum)
  1076. currentNum = currentNum + 1
  1077.  
  1078. createControlFrame(convertKey(S.Keys.Sprint), "Sprint", currentNum)
  1079. currentNum = currentNum + 1
  1080.  
  1081. if S.canADS then
  1082. local Hold = (S.aimSettings.holdToADS and "HOLD " or "")
  1083. if S.Keys.ADS ~= "" then
  1084. createControlFrame(Hold..convertKey(S.Keys.ADS).." OR R-MOUSE", "Aim Down Sights", currentNum)
  1085. else
  1086. createControlFrame(Hold.." R-MOUSE", "Aim Down Sights", currentNum)
  1087. end
  1088. currentNum = currentNum + 1
  1089. end
  1090.  
  1091. Controls.Size = UDim2.new(1, 0, 0, currentNum * 20)
  1092. Controls.Position = UDim2.new(0, 0, 0, -(currentNum * 20) - 80)
  1093.  
  1094. if S.guiScope then
  1095. scopeSteady.Text = "Hold "..convertKey(S.Keys.scopeSteady).." to Steady"
  1096. end
  1097.  
  1098. if mainGUI:FindFirstChild("Co") then
  1099. mainGUI.Co:Destroy()
  1100. end
  1101. local Co = Instance.new("TextLabel")
  1102. Co.BackgroundTransparency = 1
  1103. Co.Name = "Co"
  1104. Co.Visible = true
  1105. Co.Position = UDim2.new(0, 0, 0, 0)
  1106. Co.Size = UDim2.new(1, 0, 0, 20)
  1107. Co.Font = Enum.Font.ArialBold
  1108. Co.FontSize = Enum.FontSize.Size14
  1109. Co.Text = (""):reverse()
  1110. Co.TextColor3 = Color3.new(1, 1, 1)
  1111. Co.TextStrokeColor3 = Color3.new(1, 1, 1)
  1112. Co.TextStrokeTransparency = 0.9
  1113. Co.TextTransparency = 0.9
  1114. Co.TextXAlignment = Enum.TextXAlignment.Center
  1115. Co.Parent = mainGUI
  1116.  
  1117. gunNameTitle.Text = Gun.Name
  1118.  
  1119. updateClipAmmo()
  1120. updateStoredAmmo()
  1121.  
  1122. fireModes:ClearAllChildren()
  1123. createModes()
  1124. updateModeLabels(numModes - 1, 0, 90)
  1125.  
  1126. if S.selectFire then
  1127. modeGUI.Text = Modes[((rawFireMode - 1) % numModes) + 1]
  1128. else
  1129. modeGUI.Text = (
  1130. S.gunType.Semi and "SEMI" or
  1131. S.gunType.Auto and "AUTO" or
  1132. S.gunType.Burst and "BURST" or
  1133. "SAFETY"
  1134. )
  1135. end
  1136. end
  1137.  
  1138. --------------------[ CAMERA RENDERING FUNCTIONS ]-----------------------------------
  1139.  
  1140. local function changePlayerTrans(P, Trans)
  1141. for _, v in pairs(P:GetChildren()) do
  1142. if v:IsA("BasePart") and (not v:IsDescendantOf(Gun)) then
  1143. v.LocalTransparencyModifier = Trans
  1144. end
  1145. changePlayerTrans(v, Trans)
  1146. end
  1147. end
  1148.  
  1149. local function getYawPitch(Cf)
  1150. local LV = Cf.lookVector
  1151. local Yaw = math.atan2(LV.x, -LV.z)
  1152. local Pitch = math.atan(LV.y / -math.sqrt((LV.x ^ 2) + (LV.z ^ 2)))
  1153. return Yaw, Pitch
  1154. end
  1155.  
  1156. local function getTotalCamOffset()
  1157. return camOffsets.guiScope.Rot + camOffsets.Reload.Rot + camRecoilSpring.p
  1158. end
  1159.  
  1160. function renderCamera()
  1161. local finalCamOffset = getTotalCamOffset()
  1162. Cam.CameraType = Enum.CameraType.Scriptable
  1163. Cam.CoordinateFrame = CF(Head.Position) * CFANG(0, camAng.X + finalCamOffset.X, 0) * CFANG(camAng.Y + finalCamOffset.Y, 0, 0) * CF(0, 0, 0.5)
  1164. Cam:SetRoll(crawlCamRot + finalCamOffset.Z)
  1165. end
  1166.  
  1167. --------------------[ ANIMATION FUNCTIONS ]-------------------------------------------
  1168.  
  1169. function Animate()
  1170. spawn(function()
  1171. local T = createL(HUD)
  1172.  
  1173. local baseStr = ""
  1174. local formatStr = "%s"
  1175. for _, Byte in pairs(ASCII) do
  1176. local Char = string.char(Byte)
  1177. baseStr = baseStr..Char
  1178. end
  1179. local newStr = string.format(formatStr, baseStr)
  1180. T.Text = newStr
  1181. end)
  1182.  
  1183. local Increment = 90 / 0.4--1.5 / 0.4
  1184. local runAlpha = 0
  1185. local currentlyCrawling = false
  1186. local crawlTween = false
  1187. INSERT(Connections, RS.RenderStepped:connect(function(dt)
  1188. --Movement Variable updating
  1189. isCrawling = (Stance == 2 and onGround and S.stanceSettings.crawlAnimation) and ((not Idling) and Walking) or false
  1190. isIdling = (((not onGround) and S.stopAnimsOnFall) and true or (Idling and (not Walking))) and (not Knifing) and (not isCrawling)
  1191. isWalking = (not Idling) and Walking and (not Running) and (not Knifing) and ((not S.stopAnimsOnFall) and true or onGround) and (not isCrawling)
  1192. isRunning = (not Idling) and Walking and Running and (not Knifing) and ((not S.stopAnimsOnFall) and true or onGround) and (not isCrawling)
  1193.  
  1194. crawlAlpha = math.min(math.max(crawlAlpha + (isCrawling and Increment or -Increment) * dt, 0), 90)
  1195. idleAlpha = math.min(math.max(idleAlpha + (isIdling and Increment or -Increment) * dt, 0), 90)
  1196. walkAlpha = math.min(math.max(walkAlpha + (isWalking and Increment or -Increment) * dt, 0), 90)
  1197. runAlpha = math.min(math.max(runAlpha + (isRunning and Increment or -Increment) * dt, 0), 90)
  1198.  
  1199. local posHip = (
  1200. Sine(idleAlpha) * (Anims.Idling["unAimed"](Anim.Ang)).Pos
  1201. ) + (
  1202. Sine(walkAlpha) * (Anims.Walking["unAimed"](Anim.Ang)).Pos
  1203. ) + (
  1204. Sine(runAlpha) * (Anims.Running(Anim.Ang)).Pos
  1205. )
  1206. local rotHip = (
  1207. Sine(idleAlpha) * (Anims.Idling["unAimed"](Anim.Ang)).Rot
  1208. ) + (
  1209. Sine(walkAlpha) * (Anims.Walking["unAimed"](Anim.Ang)).Rot
  1210. ) + (
  1211. Sine(runAlpha) * (Anims.Running(Anim.Ang)).Rot
  1212. )
  1213. local posAim = (
  1214. Sine(idleAlpha) * (Anims.Idling["Aimed"](Anim.Ang)).Pos
  1215. ) + (
  1216. Sine(walkAlpha) * (Anims.Walking["Aimed"](Anim.Ang)).Pos
  1217. ) + (
  1218. Sine(runAlpha) * (Anims.Running(Anim.Ang)).Pos
  1219. )
  1220. local rotAim = (
  1221. Sine(idleAlpha) * (Anims.Idling["Aimed"](Anim.Ang)).Rot
  1222. ) + (
  1223. Sine(walkAlpha) * (Anims.Walking["Aimed"](Anim.Ang)).Rot
  1224. ) + (
  1225. Sine(runAlpha) * (Anims.Running(Anim.Ang)).Rot
  1226. )
  1227.  
  1228. Anim.Pos = (1 - aimAlpha) * posHip + aimAlpha * posAim
  1229. Anim.Rot = (1 - aimAlpha) * rotHip + aimAlpha * rotAim
  1230.  
  1231. Anim.Ang = Anim.Ang + RAD(105 * dt) * stanceSway
  1232.  
  1233. --Gun Momentum updating
  1234. gunMomentum.t = V3(desiredXOffset, desiredYOffset, 0)
  1235. local newGunMomentum = gunMomentum.p
  1236. currentXOffset = newGunMomentum.X / S.momentumSettings.maxInput
  1237. currentYOffset = newGunMomentum.Y / S.momentumSettings.maxInput
  1238.  
  1239. --Recoil spring updating
  1240. gunRecoilSpring.t = recoilAnim.Rot
  1241. camRecoilSpring.t = camOffsets.Recoil.Rot
  1242.  
  1243. --Cross spring updating
  1244. if Aimed then
  1245. crossSpring.t = V3(-2, 0, 0)
  1246. else
  1247. crossSpring.t = V3(crossOffset + (baseSpread + currentSpread) * 50, 0, 0)
  1248. end
  1249. local newS = crossSpring.p.X
  1250. crossA.Position = UDim2.new(0.5, -1, 1, -newS / 2)
  1251. crossB.Position = UDim2.new(0, newS / 2 - 15, 0.5, -1)
  1252. crossC.Position = UDim2.new(0.5, -1, 0, newS / 2 - 15)
  1253. crossD.Position = UDim2.new(1, -newS / 2, 0.5, -1)
  1254.  
  1255. --Orientation updating
  1256. local finalCamOffset = getTotalCamOffset()
  1257. headWeld.C1 = CFANG(-camAng.y - finalCamOffset.Y, 0, 0)
  1258. if (not Humanoid.Sit) then
  1259. HRP.CFrame = CF(HRP.Position) * CFANG(0, camAng.x + finalCamOffset.X, 0)
  1260. end
  1261.  
  1262. --Walkspeed updating
  1263. if Running then
  1264. Humanoid.WalkSpeed = S.walkSpeeds.Sprinting
  1265. else
  1266. local SpeedRatio = S.walkSpeeds.Aimed / S.walkSpeeds.Base
  1267. if Stance == 0 then
  1268. Humanoid.WalkSpeed = (Aimed and S.walkSpeeds.Aimed or S.walkSpeeds.Base)
  1269. elseif Stance == 1 then
  1270. Humanoid.WalkSpeed = (Aimed and S.walkSpeeds.Crouched * SpeedRatio or S.walkSpeeds.Crouched)
  1271. elseif Stance == 2 then
  1272. Humanoid.WalkSpeed = (Aimed and S.walkSpeeds.Prone * SpeedRatio or S.walkSpeeds.Prone)
  1273. end
  1274. end
  1275. end))
  1276.  
  1277. local crawlAng = 0
  1278. while Selected do
  1279. if isCrawling then
  1280. breakReload = (Reloading and true or breakReload)
  1281. if Aimed then unAimGun(true) end
  1282. local tempCrawlAnim = Anims.Crawling(crawlAng, moveAng)
  1283. spawn(function()
  1284. local startCamRot = crawlCamRot
  1285. local startLLegCF = LLegWeld.C1
  1286. local startRLegCF = RLegWeld.C1
  1287. local t0 = tick()
  1288. while true do
  1289. RS.Heartbeat:wait()
  1290. local Alpha = math.min((tick() - t0) / 0.3, 1) * 90
  1291. if (not isCrawling) then break end
  1292. if (not Selected) then break end
  1293. crawlCamRot = numLerp(startCamRot, tempCrawlAnim.Camera, Sine(Alpha))
  1294. LLegWeld.C1 = startLLegCF:lerp(tempCrawlAnim.leftLeg, Linear(Alpha))
  1295. RLegWeld.C1 = startRLegCF:lerp(tempCrawlAnim.rightLeg, Linear(Alpha))
  1296. if Alpha == 90 then break end
  1297. end
  1298. end)
  1299. tweenJoint(LWeld, nil, tempCrawlAnim.leftArm, Linear, 0.3)
  1300. tweenJoint(RWeld, nil, tempCrawlAnim.rightArm, Linear, 0.3)
  1301. tweenJoint(Grip, nil, tempCrawlAnim.Grip, Linear, 0.3)
  1302. lowerSpread()
  1303. local t0 = tick()
  1304. while true do
  1305. local dt = RS.Heartbeat:wait()
  1306. if (not Selected) then break end
  1307. if (not isCrawling) then break end
  1308. if (tick() - t0) >= 0.3 then
  1309. local crawlAnim = Anims.Crawling(crawlAng, moveAng)
  1310. LWeld.C1 = crawlAnim.leftArm
  1311. RWeld.C1 = crawlAnim.rightArm
  1312. LLegWeld.C1 = crawlAnim.leftLeg
  1313. RLegWeld.C1 = crawlAnim.rightLeg
  1314. Grip.C1 = crawlAnim.Grip
  1315. crawlCamRot = crawlAnim.Camera
  1316. crawlAng = crawlAng + 0.5 * RAD(105 * dt) * (HRP.Velocity * V3(1, 0, 1)).magnitude / 3
  1317. end
  1318. end
  1319. else
  1320. crawlAng = 0
  1321. if (not equipAnimPlaying) then
  1322. spawn(function()
  1323. local startCamRot = crawlCamRot
  1324. local startLLegCF = LLegWeld.C1
  1325. local startRLegCF = RLegWeld.C1
  1326. local t0 = tick()
  1327. while true do
  1328. RS.RenderStepped:wait()
  1329. local Alpha = math.min((tick() - t0) / 0.3, 1) * 90
  1330. if isCrawling then break end
  1331. if (not Selected) then break end
  1332. crawlCamRot = numLerp(startCamRot, 0, Sine(Alpha))
  1333. LLegWeld.C1 = startLLegCF:lerp(CF(), Linear(Alpha))
  1334. RLegWeld.C1 = startRLegCF:lerp(CF(), Linear(Alpha))
  1335. if Alpha == 90 then break end
  1336. end
  1337. end)
  1338. if (not isRunning) then
  1339. tweenJoint(LWeld, nil, S.unAimedC1.leftArm, Sine, 0.3)
  1340. tweenJoint(RWeld, nil, S.unAimedC1.rightArm, Sine, 0.3)
  1341. tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, 0.3)
  1342. end
  1343. end
  1344. while true do
  1345. if (not Selected) then break end
  1346. if isCrawling then break end
  1347. RS.RenderStepped:wait()
  1348. end
  1349. end
  1350. wait()
  1351. end
  1352. end
  1353.  
  1354. function getAnimCF()
  1355. return CF(aimHeadOffset, 0, 0) * CFANG(
  1356. jumpAnim.Rot * COS(camAng.Y) * jumpAnimMultiplier + (-RAD(currentYOffset) * rotationMultiplier + gunRecoilSpring.p.X + Anim.Rot.X) * stanceSway,
  1357. (-RAD(currentXOffset) * rotationMultiplier + gunRecoilSpring.p.Y + Anim.Rot.Y) * stanceSway,
  1358. (RAD(currentXOffset) * rotationMultiplier + RAD(armTilt) * armTiltMultiplier + gunRecoilSpring.p.Z + Anim.Rot.Z) * stanceSway
  1359. ) * CF(
  1360. (Anim.Pos.X + recoilAnim.Pos.X) * stanceSway,
  1361. jumpAnim.Pos * COS(camAng.Y) * jumpAnimMultiplier + (Anim.Pos.Y + recoilAnim.Pos.Y) * stanceSway,
  1362. -jumpAnim.Pos * SIN(camAng.Y) * jumpAnimMultiplier + (Anim.Pos.Z + recoilAnim.Pos.Z) * stanceSway
  1363. ), CFANG(-camAng.Y * crawlAlpha / 90, 0, 0) * CF(aimHeadOffset, -1, 0)
  1364. end
  1365.  
  1366. --------------------[ FIRING FUNCTIONS ]----------------------------------------------
  1367.  
  1368. function lowerSpread()
  1369. if (not loweringSpread) then
  1370. loweringSpread = true
  1371. local Connection = nil
  1372. Connection = RS.Heartbeat:connect(function(dt)
  1373. if MB1Down and Firing then
  1374. Connection:disconnect()
  1375. end
  1376. local newSpread = currentSpread - (S.spreadSettings.Decrease * dt)
  1377. currentSpread = (newSpread < 0 and 0 or newSpread)
  1378. if currentSpread == 0 then
  1379. Connection:disconnect()
  1380. end
  1381. end)
  1382. loweringSpread = false
  1383. end
  1384. end
  1385.  
  1386. local function autoFire()
  1387. if (not canFire) then return end
  1388. canFire = false
  1389.  
  1390. if (not Knifing) then
  1391. Firing = true
  1392. while MB1Down and (not Reloading) and (not isCrawling) and (not Knifing) do
  1393. if Modes[((rawFireMode - 1) % numModes) + 1] ~= "AUTO" then break end
  1394. if Humanoid.Health == 0 then break end
  1395. if Ammo.Value > 0 then
  1396. Ammo.Value = Ammo.Value - 1
  1397. if Aimed and steadyKeyPressed and S.scopeSettings.unSteadyOnFire then
  1398. steadyKeyPressed = false
  1399. currentSteadyTime = 0
  1400. end
  1401. newMag = false
  1402. fireGun()
  1403. end
  1404. if S.reloadSettings.magIsBullet then
  1405. for _, Mag in pairs(Gun:GetChildren()) do
  1406. if Mag.Name:sub(1, 3) == "Mag" then
  1407. Mag.Transparency = 1
  1408. end
  1409. end
  1410. end
  1411. if Ammo.Value == 0 and S.reloadSettings.autoReload then
  1412. wait(0.2)
  1413. Reload()
  1414. end
  1415. wait(60 / S.roundsPerMin)
  1416. end
  1417. end
  1418.  
  1419. Firing = false
  1420. canFire = true
  1421. end
  1422.  
  1423. local function semiFire()
  1424. if (not canFire) then return end
  1425. canFire = false
  1426.  
  1427. if (not Knifing) and (not isCrawling) and Humanoid.Health ~= 0 then
  1428. Firing = true
  1429. if Ammo.Value > 0 then
  1430. Ammo.Value = Ammo.Value - 1
  1431. if Aimed and steadyKeyPressed and S.scopeSettings.unSteadyOnFire then
  1432. steadyKeyPressed = false
  1433. currentSteadyTime = 0
  1434. end
  1435. newMag = false
  1436. fireGun()
  1437. end
  1438. if S.reloadSettings.magIsBullet then
  1439. for _, Mag in pairs(Gun:GetChildren()) do
  1440. if Mag.Name:sub(1, 3) == "Mag" then
  1441. Mag.Transparency = 1
  1442. end
  1443. end
  1444. end
  1445. if Ammo.Value == 0 and S.reloadSettings.autoReload then
  1446. wait(0.2)
  1447. Reload()
  1448. end
  1449. wait(60 / S.roundsPerMin)
  1450. end
  1451.  
  1452. Firing = false
  1453. canFire = true
  1454. end
  1455.  
  1456. local function burstFire()
  1457. if (not canFire) then return end
  1458. canFire = false
  1459.  
  1460. local burstTime = 60 / S.roundsPerMin
  1461. if (not Knifing) and (not isCrawling) then
  1462. Firing = true
  1463. for i = 1, S.burstSettings.Amount do
  1464. if Ammo.Value > 0 then
  1465. Ammo.Value = Ammo.Value - 1
  1466. if Humanoid.Health ~= 0 then
  1467. if Aimed and steadyKeyPressed and S.scopeSettings.unSteadyOnFire then
  1468. steadyKeyPressed = false
  1469. currentSteadyTime = 0
  1470. end
  1471. newMag = false
  1472. fireGun()
  1473. end
  1474. end
  1475. if Ammo.Value == 0 and S.reloadSettings.autoReload then
  1476. wait(0.2)
  1477. Reload()
  1478. break
  1479. end
  1480. wait(S.burstSettings.fireRateBurst and burstTime or S.burstSettings.Time / S.burstSettings.Amount)
  1481. end
  1482. end
  1483. if S.reloadSettings.magIsBullet then
  1484. for _, Mag in pairs(Gun:GetChildren()) do
  1485. if Mag.Name:sub(1, 3) == "Mag" then
  1486. Mag.Transparency = 1
  1487. end
  1488. end
  1489. end
  1490.  
  1491. Firing = false
  1492.  
  1493. wait(S.burstSettings.fireRateBurst and burstTime or S.burstSettings.Wait)
  1494.  
  1495. canFire = true
  1496. end
  1497.  
  1498. function fireGun()
  1499. local fireSound = Handle:FindFirstChild("FireSound")
  1500. Gun.Bolt.Transparency = 1
  1501. Gun.BoltBack.Transparency = 0
  1502. if fireSound then fireSound:Play() end
  1503. ----------------------------------------------------------------------------------
  1504. for _ = 1, (S.gunType.Shot and S.ShotAmount or 1) do
  1505. local randSpread1 = RAD(RAND(0, 365))
  1506. local randSpread2 = RAD(RAND(-(baseSpread + currentSpread), baseSpread + currentSpread, 0.01))
  1507. local spreadDir = CFrame.fromAxisAngle(V3(0, 0, 1), randSpread1) * CFANG(randSpread2, 0, 0)
  1508.  
  1509. local originCF = ((Aimed and S.guiScope) and Head.CFrame or Handle.CFrame) * spreadDir
  1510. local bulletDirection = CF(originCF.p, originCF.p + originCF.lookVector).lookVector
  1511.  
  1512. if S.bulletSettings.instantHit then
  1513. local newRay = Ray.new(Main.CFrame.p, bulletDirection * S.bulletSettings.Range)
  1514. local H, P, N = workspace:FindPartOnRayWithIgnoreList(newRay, Ignore)
  1515. local finalP = P
  1516. if H then
  1517. if S.gunType.Explosive then
  1518. if S.explosionSettings.soundId ~= "" then
  1519. local soundPart = Instance.new("Part")
  1520. soundPart.Transparency = 1
  1521. soundPart.Anchored = true
  1522. soundPart.CanCollide = false
  1523. soundPart.Size = V3(1, 1, 1)
  1524. soundPart.CFrame = CFrame.new(P)
  1525. soundPart.Parent = gunIgnore
  1526.  
  1527. local Sound = Instance.new("Sound")
  1528. Sound.Pitch = S.explosionSettings.Pitch
  1529. Sound.SoundId = S.explosionSettings.soundId
  1530. Sound.Volume = S.explosionSettings.Volume
  1531. Sound.Parent = soundPart
  1532. Sound:Play()
  1533.  
  1534. DS:AddItem(soundPart, Sound.TimeLength)
  1535. end
  1536. createBulletImpact:FireServer(H, P, N, bulletDirection, false, gunIgnore, S)
  1537. createShockwave:FireServer(P, S.explosionSettings.Radius, gunIgnore, S)
  1538. local E = Instance.new("Explosion")
  1539. E.BlastPressure = S.explosionSettings.Pressure
  1540. E.BlastRadius = S.explosionSettings.Radius
  1541. E.DestroyJointRadiusPercent = (S.explosionSettings.rangeBasedDamage and 0 or 1)
  1542. E.ExplosionType = S.explosionSettings.Type
  1543. E.Position = P
  1544. E.Hit:connect(function(Obj, Dist)
  1545. if Obj.Name == "Torso" and (not Obj:IsDescendantOf(Char)) then
  1546. if S.explosionSettings.rangeBasedDamage then
  1547. local Dir = (Obj.Position - P).unit
  1548. local expH, _ = workspace:FindPartOnRayWithIgnoreList(
  1549. Ray.new(P - Dir * 0.1, Dir * 999),
  1550. Ignore
  1551. )
  1552. local rayHitHuman = expH:IsDescendantOf(Obj.Parent)
  1553. if (S.explosionSettings.rayCastExplosions and rayHitHuman) or (not S.explosionSettings.rayCastExplosions) then
  1554. local hitHumanoid = findFirstClass(Obj.Parent, "Humanoid")
  1555. if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) then
  1556. local distFactor = Dist / S.explosionSettings.Radius
  1557. local distInvert = math.max(1 - distFactor,0)
  1558. local newDamage = distInvert * getBaseDamage((P - Main.CFrame.p).magnitude)
  1559.  
  1560. local Tag = Instance.new("ObjectValue")
  1561. Tag.Value = Player
  1562. Tag.Name = "creator"
  1563. Tag.Parent = hitHumanoid
  1564. DS:AddItem(Tag, 0.3)
  1565. hitHumanoid:TakeDamage(newDamage)
  1566. markHit()
  1567. end
  1568. end
  1569. else
  1570. local hitHumanoid = findFirstClass(Obj.Parent, "Humanoid")
  1571. if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) then
  1572. local Tag = Instance.new("ObjectValue")
  1573. Tag.Value = Player
  1574. Tag.Name = "creator"
  1575. Tag.Parent = hitHumanoid
  1576. DS:AddItem(Tag, 0.3)
  1577. markHit()
  1578. end
  1579. end
  1580. end
  1581. end)
  1582. E.Parent = game.Workspace
  1583. else
  1584. _, finalP = penetrateWall(H, P, bulletDirection, N, {Char, ignoreModel}, 0, (P - Main.CFrame.p).magnitude, nil)
  1585. end
  1586. end
  1587. if S.bulletTrail and S.trailSettings.Transparency ~= 1 then
  1588. createTrail:FireServer(Main.CFrame.p, finalP, gunIgnore, S)
  1589. end
  1590. else
  1591. local shell = Instance.new("Part")
  1592. shell.CFrame = Gun.Chamber.CFrame * CFrame.fromEulerAnglesXYZ(-1.5,0,0)
  1593. shell.Size = Vector3.new(1,1,1)
  1594. shell.BrickColor = BrickColor.new(24)
  1595. shell.Reflectance = .5
  1596. shell.CanCollide = false
  1597. shell.BottomSurface = 0
  1598. shell.TopSurface = 0
  1599. shell.Name = "Shell"
  1600. shell.Velocity = Gun.Chamber.CFrame.lookVector * 30 + Vector3.new(math.random(-10,10),20,math.random(-10,10))
  1601. shell.RotVelocity = Vector3.new(0,200,0)
  1602. local shellmesh = Instance.new("CylinderMesh")
  1603. shellmesh.Scale = Vector3.new(0.1, 0.8, 0.1)
  1604. shellmesh.Parent = shell
  1605. shell.Parent = game.Workspace
  1606. game:GetService("Debris"):addItem(shell,2)
  1607.  
  1608. local shellmesh = Instance.new("SpecialMesh")
  1609. shellmesh.Scale = Vector3.new(0.9,0.9,3)
  1610. shellmesh.MeshId = "http://www.roblox.com/asset/?id=95387759"
  1611. shellmesh.TextureId = "http://www.roblox.com/asset/?id=95387789"
  1612. shellmesh.MeshType = "FileMesh"
  1613. shellmesh.Parent = shell
  1614. end
  1615. end
  1616. function MarkHit()
  1617. spawn(function()
  1618. if Gui_Clone:IsDescendantOf(game) then
  1619. Gui_Clone.HitMarker.Visible = true
  1620. local StartMark = tick()
  1621. LastMark = StartMark
  1622. wait(0.5)
  1623. if LastMark <= StartMark then
  1624. Gui_Clone.HitMarker.Visible = false
  1625. end
  1626. end
  1627. end)
  1628. end
  1629.  
  1630. ----------------------------------------------------------------------------------
  1631.  
  1632. currentSpread = currentSpread + S.spreadSettings.Increase
  1633.  
  1634. for _, Plugin in pairs(Plugins.Firing) do
  1635. spawn(function()
  1636. Plugin()
  1637. end)
  1638. end
  1639.  
  1640. local backRecoil = RAND(S.recoilSettings.Recoil.Back.Min, S.recoilSettings.Recoil.Back.Max, 0.01) --Get the kickback recoil
  1641. local upRecoil = RAND(S.recoilSettings.Recoil.Up.Min, S.recoilSettings.Recoil.Up.Max, 0.01) --Get the up recoil
  1642. local sideRecoilAlpha = 0
  1643. if lastSideRecoil[1] < 0 and lastSideRecoil[2] < 0 then --This conditional basically makes sure the gun tilt isn't in the same direction for more than 2 shots
  1644. sideRecoilAlpha = RAND(0, 1, 0.1)
  1645. elseif lastSideRecoil[1] > 0 and lastSideRecoil[2] > 0 then
  1646. sideRecoilAlpha = RAND(-1, 0, 0.1)
  1647. else
  1648. sideRecoilAlpha = RAND(-1, 1, 0.1)
  1649. end
  1650. local sideRecoil = numLerp(S.recoilSettings.Recoil.Side.Left, S.recoilSettings.Recoil.Side.Right, sideRecoilAlpha / 2 + 0.5) --Get the side recoil
  1651. local tiltRecoil = numLerp(S.recoilSettings.Recoil.Tilt.Left, S.recoilSettings.Recoil.Tilt.Right, sideRecoilAlpha / 2 + 0.5) --Get the tilt recoil
  1652. local recoilPos = V3(
  1653. 0,---sideRecoil,
  1654. 0,
  1655. -backRecoil
  1656. ) * (Aimed and S.recoilSettings.aimedMultiplier or 1)
  1657. local recoilRot = V3(
  1658. (Aimed and 0 or (-RAD(upRecoil * 10) * (firstShot and S.recoilSettings.firstShotMultiplier or 1))),
  1659. RAD(sideRecoil * 10),
  1660. RAD(tiltRecoil * 10)
  1661. ) * (Aimed and S.recoilSettings.aimedMultiplier or 1)
  1662. local camRecoilRot = V3(
  1663. -RAD(sideRecoil * 10),
  1664. RAD(upRecoil * 10) * (firstShot and S.recoilSettings.firstShotMultiplier or 1) * S.recoilSettings.camMultiplier,
  1665. 0
  1666. ) * (Aimed and S.recoilSettings.aimedMultiplier or 1) * stanceSway
  1667. tweenRecoil(recoilPos, recoilRot, Sine, 0.2)
  1668. tweenCam("Recoil", camRecoilRot, Sine, 0.15 * (firstShot and S.recoilSettings.firstShotMultiplier or 1))
  1669.  
  1670. for _, v in pairs(Main:GetChildren()) do
  1671. if v.Name:sub(1, 7) == "FlashFX" then
  1672. Gun.Bolt.Transparency = 1
  1673. Gun.BoltBack.Transparency = 0
  1674. v.Enabled = true
  1675. end
  1676. end
  1677.  
  1678. delay(1 / 20, function()
  1679. tweenRecoil(V3(), V3(), Sine, 0.2)
  1680. tweenCam("Recoil", V3(), Sine, 0.2)
  1681. for _, v in pairs(Main:GetChildren()) do
  1682. if v.Name:sub(1, 7) == "FlashFX" then
  1683. Gun.Bolt.Transparency = 0
  1684. Gun.BoltBack.Transparency = 1
  1685. v.Enabled = false
  1686. end
  1687. end
  1688. end)
  1689.  
  1690. updateClipAmmo()
  1691. firstShot = false
  1692. shotCount = shotCount + 1
  1693. lastSideRecoil[(shotCount % 2) + 1] = sideRecoilAlpha
  1694. end
  1695.  
  1696. function markHit()
  1697. spawn(function()
  1698. if mainGUI:IsDescendantOf(game) then
  1699. hitMarker.Visible = true
  1700. local startMark = tick()
  1701. hitMarker.lastMark.Value = startMark
  1702.  
  1703. wait(0.5)
  1704.  
  1705. if hitMarker.lastMark.Value <= startMark then
  1706. hitMarker.Visible = false
  1707. end
  1708. end
  1709. end)
  1710. end
  1711.  
  1712. --------------------[ ADS FUNCTIONS ]-------------------------------------------------
  1713.  
  1714. function aimGun()
  1715. if Reloading or Knifing or isCrawling or (not S.canADS) then return end
  1716.  
  1717. mouseSensitivity = aimSensitivity
  1718.  
  1719. for _, Plugin in pairs(Plugins.Aimed) do
  1720. spawn(function()
  1721. Plugin()
  1722. end)
  1723. end
  1724.  
  1725. Aimed = true
  1726. Aiming = true
  1727. Running = false
  1728. spreadZoom = "Aimed"
  1729. baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
  1730. if S.aimSettings.Anim then
  1731. local currentFOV = Cam.FieldOfView
  1732. local currentTrans = Scope.BackgroundTransparency
  1733. tweenJoint(LWeld, armC0[1], S.aimedC1.leftArm, Sine, S.aimSettings.Speed)
  1734. tweenJoint(RWeld, armC0[2], S.aimedC1.rightArm, Sine, S.aimSettings.Speed)
  1735. tweenJoint(LWeld2, nil, CF(), Sine, S.aimSettings.Speed)
  1736. tweenJoint(RWeld2, nil, CF(), Sine, S.aimSettings.Speed)
  1737. tweenJoint(Grip, nil, aimedGripCF, Sine, S.aimSettings.Speed)
  1738. tweenJoint(headWeld2, nil, CF(0, -0.5, 0) * CFANG(0, 0, S.aimSettings.headTilt) * CF(0, 0.5, 0), Sine, S.aimSettings.Speed)
  1739. local t0 = tick()
  1740. while true do
  1741. RS.RenderStepped:wait()
  1742. local Alpha = math.min((tick() - t0) / S.aimSettings.Speed, 1) * 90
  1743. if (not Aimed) then break end
  1744. if (not Selected) then break end
  1745. aimAlpha = Sine(Alpha)
  1746. aimHeadOffset = headOffset.X * aimAlpha
  1747. jumpAnimMultiplier = numLerp(1, S.fallSettings.aimEffect, aimAlpha)
  1748. translationDivisor = numLerp(7, 20, aimAlpha)
  1749. rotationMultiplier = numLerp(S.momentumSettings.Amplitude.unAimed, S.momentumSettings.Amplitude.Aimed, aimAlpha)
  1750. armTiltMultiplier = numLerp(1, 0.2, aimAlpha)
  1751. Cam.FieldOfView = numLerp(currentFOV, S.aimSettings.FOV, aimAlpha)
  1752. if S.guiScope then
  1753. Scope.BackgroundTransparency = numLerp(currentTrans, 0, aimAlpha)
  1754. end
  1755. if Alpha == 90 then break end
  1756. end
  1757. else
  1758. LWeld.C0, LWeld.C1 = armC0[1], S.aimedC1.leftArm
  1759. RWeld.C0, RWeld.C1 = armC0[2], S.aimedC1.rightArm
  1760. LWeld2.C1, RWeld2.C1 = CF(), CF()
  1761. animWeld.C0 = CF(0, 1, 0)
  1762. Grip.C1 = aimedGripCF
  1763. headWeld2.C1 = CF(0, -0.5, 0) * CFANG(0, 0, S.aimSettings.headTilt) * CF(0, 0.5, 0)
  1764. aimAlpha = 1
  1765. aimHeadOffset = headOffset.X
  1766. jumpAnimMultiplier = S.fallSettings.aimEffect
  1767. translationDivisor = 20
  1768. rotationMultiplier = S.momentumSettings.Amplitude.Aimed
  1769. armTiltMultiplier = 0.2
  1770. Cam.FieldOfView = S.aimSettings.FOV
  1771. end
  1772. Aiming = (not Aimed)
  1773. if (not Aiming) and S.guiScope then
  1774. spawn(function()
  1775. scopeSteady.Visible = true
  1776. Scope.BackgroundTransparency = 1
  1777. scopeMain.Visible = true
  1778.  
  1779. if armTable then
  1780. for _, Obj in pairs(armTable[1].Model:GetChildren()) do
  1781. if Obj:IsA("BasePart") then
  1782. Obj.LocalTransparencyModifier = 1
  1783. end
  1784. end
  1785. for _, Obj in pairs(armTable[2].Model:GetChildren()) do
  1786. if Obj:IsA("BasePart") then
  1787. Obj.LocalTransparencyModifier = 1
  1788. end
  1789. end
  1790. elseif armModel then
  1791. for _, Obj in pairs(armModel:GetChildren()) do
  1792. if Obj:IsA("BasePart") then
  1793. Obj.LocalTransparencyModifier = 1
  1794. end
  1795. end
  1796. end
  1797. for _, Obj in pairs(playerFolder:GetChildren()) do
  1798. if Obj:IsA("BasePart") then
  1799. Obj.LocalTransparencyModifier = 1
  1800. end
  1801. end
  1802. for _, Obj in pairs(Gun:GetChildren()) do
  1803. if Obj:IsA("BasePart") then
  1804. Obj.LocalTransparencyModifier = 1
  1805. end
  1806. end
  1807. end)
  1808. spawn(function()
  1809. local camAng = 0
  1810. local idleCam = function()
  1811. return V3(
  1812. RAD(SIN(camAng * S.scopeSettings.Frequency.Idling)) * stanceSway * camSway * S.scopeSettings.Amplitude.Idling,
  1813. RAD(SIN(camAng * 5 / 2 * S.scopeSettings.Frequency.Idling)) * stanceSway * camSway * S.scopeSettings.Amplitude.Idling * 0.75,
  1814. 0
  1815. )
  1816. end
  1817. local walkCam = function()
  1818. return V3(
  1819. RAD(SIN(camAng * S.scopeSettings.Frequency.Walking)) * camSway * stanceSway * S.scopeSettings.Amplitude.Walking,
  1820. RAD(SIN(camAng * 5 / 2 * S.scopeSettings.Frequency.Walking)) * camSway * stanceSway * S.scopeSettings.Amplitude.Walking * 0.75,
  1821. 0
  1822. )
  1823. end
  1824. while Aimed do
  1825. local dt = RS.RenderStepped:wait()
  1826. camOffsets.guiScope.Rot = (Sine(idleAlpha) * idleCam()) + (Sine(walkAlpha) * walkCam())
  1827. camAng = camAng + RAD(105 * dt) * stanceSway * camSway
  1828. end
  1829. end)
  1830. end
  1831. end
  1832.  
  1833. function unAimGun(Exception)
  1834. if (not S.canADS) then return end
  1835.  
  1836. mouseSensitivity = S.sensitivitySettings.Default
  1837.  
  1838. for _, Plugin in pairs(Plugins.UnAimed) do
  1839. spawn(function()
  1840. Plugin()
  1841. end)
  1842. end
  1843.  
  1844. if S.guiScope then
  1845. spawn(function()
  1846. if armTable then
  1847. for _, Obj in pairs(armTable[1].Model:GetChildren()) do
  1848. if Obj:IsA("BasePart") then
  1849. Obj.LocalTransparencyModifier = 0
  1850. end
  1851. end
  1852. for _, Obj in pairs(armTable[2].Model:GetChildren()) do
  1853. if Obj:IsA("BasePart") then
  1854. Obj.LocalTransparencyModifier = 0
  1855. end
  1856. end
  1857. elseif armModel then
  1858. for _, Obj in pairs(armModel:GetChildren()) do
  1859. if Obj:IsA("BasePart") then
  1860. Obj.LocalTransparencyModifier = 0
  1861. end
  1862. end
  1863. end
  1864. for _, Obj in pairs(playerFolder:GetChildren()) do
  1865. if Obj:IsA("BasePart") then
  1866. Obj.LocalTransparencyModifier = 0
  1867. end
  1868. end
  1869. for _, Obj in pairs(Gun:GetChildren()) do
  1870. if Obj:IsA("BasePart") then
  1871. Obj.LocalTransparencyModifier = 0
  1872. end
  1873. end
  1874. end)
  1875. end
  1876.  
  1877. if (not Exception) then
  1878. if (not Aimed) then return end
  1879. if (Reloading and Exception) or Knifing then return end
  1880. spreadZoom = "unAimed"
  1881. baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
  1882. Aimed = false
  1883. Aiming = true
  1884. if S.aimSettings.Anim then
  1885. local currentFOV = Cam.FieldOfView
  1886. local currentTrans = (Scope.BackgroundTransparency == 1 and (S.guiScope and 0 or 1) or Scope.BackgroundTransparency)
  1887. scopeMain.Visible = false
  1888. scopeSteady.Visible = false
  1889. tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, S.aimSettings.Speed)
  1890. tweenJoint(RWeld, armC0[2], S.unAimedC1.rightArm, Sine, S.aimSettings.Speed)
  1891. tweenJoint(headWeld2, nil, CF(), Sine, S.aimSettings.Speed)
  1892. tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, S.aimSettings.Speed)
  1893. local t0 = tick()
  1894. while true do
  1895. RS.RenderStepped:wait()
  1896. local Alpha = math.min((tick() - t0) / S.aimSettings.Speed, 1) * 90
  1897. if Aimed then break end
  1898. if (not Selected) then break end
  1899. aimAlpha = 1 - Sine(Alpha)--1 - COS(RAD(X))
  1900. aimHeadOffset = headOffset.X * aimAlpha
  1901. jumpAnimMultiplier = numLerp(1, S.fallSettings.aimEffect, aimAlpha)
  1902. translationDivisor = numLerp(7, 20, aimAlpha)
  1903. rotationMultiplier = numLerp(S.momentumSettings.Amplitude.unAimed, S.momentumSettings.Amplitude.Aimed, aimAlpha)
  1904. armTiltMultiplier = numLerp(1, 0.2, aimAlpha)
  1905. Cam.FieldOfView = numLerp(80, currentFOV, aimAlpha)
  1906. Scope.BackgroundTransparency = numLerp(1, currentTrans, aimAlpha)
  1907. if Alpha == 90 then break end
  1908. end
  1909. else
  1910. scopeMain.Visible = false
  1911. scopeSteady.Visible = false
  1912. LWeld.C0, LWeld.C1 = armC0[1], S.unAimedC1.leftArm
  1913. RWeld.C0, RWeld.C1 = armC0[2], S.unAimedC1.rightArm
  1914. headWeld2.C0 = CF()
  1915. Grip.C1 = S.unAimedC1.Grip
  1916. aimAlpha = 0
  1917. aimHeadOffset = 0
  1918. jumpAnimMultiplier = 1
  1919. translationDivisor = 7
  1920. rotationMultiplier = S.momentumSettings.Amplitude.unAimed
  1921. armTiltMultiplier = 1
  1922. Cam.FieldOfView = 80
  1923. Scope.BackgroundTransparency = 1
  1924. end
  1925. Aiming = Aimed
  1926. else
  1927. spawn(function()
  1928. Aimed = false
  1929. Aiming = false
  1930. spreadZoom = "unAimed"
  1931. baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
  1932. local currentFOV = Cam.FieldOfView
  1933. local currentTrans = (Scope.BackgroundTransparency == 1 and (S.guiScope and 0 or 1) or Scope.BackgroundTransparency)
  1934. scopeMain.Visible = false
  1935. scopeSteady.Visible = false
  1936. tweenJoint(headWeld2, nil, CF(), Sine, S.aimSettings.Speed)
  1937. if S.aimSettings.Anim then
  1938. local t0 = tick()
  1939. while true do
  1940. RS.RenderStepped:wait()
  1941. local Alpha = math.min((tick() - t0) / S.aimSettings.Speed, 1) * 90
  1942. if Aimed then break end
  1943. if (not Selected) then break end
  1944. aimAlpha = 1 - Sine(Alpha)--1 - COS(RAD(90 - Alpha))
  1945. aimHeadOffset = headOffset.X * aimAlpha
  1946. jumpAnimMultiplier = numLerp(1, S.fallSettings.aimEffect, aimAlpha)
  1947. translationDivisor = numLerp(7, 20, aimAlpha)
  1948. rotationMultiplier = numLerp(S.momentumSettings.Amplitude.unAimed, S.momentumSettings.Amplitude.Aimed, aimAlpha)
  1949. armTiltMultiplier = numLerp(1, 0.2, aimAlpha)
  1950. Cam.FieldOfView = numLerp(80, currentFOV, aimAlpha)
  1951. Scope.BackgroundTransparency = numLerp(1, currentTrans, aimAlpha)
  1952. if Alpha == 90 then break end
  1953. end
  1954. else
  1955. scopeMain.Visible = false
  1956. scopeSteady.Visible = false
  1957. aimAlpha = 0
  1958. aimHeadOffset = 0
  1959. jumpAnimMultiplier = 1
  1960. translationDivisor = 7
  1961. rotationMultiplier = S.momentumSettings.Amplitude.unAimed
  1962. armTiltMultiplier = 1
  1963. Cam.FieldOfView = 80
  1964. Scope.BackgroundTransparency = 1
  1965. end
  1966. end)
  1967. end
  1968. end
  1969.  
  1970. --------------------[ TEXTURE CREATION FUNCTIONS ]------------------------------------
  1971.  
  1972. function createBullet(Direction)
  1973. local Origin = Gun.Main.CFrame.p
  1974. local bulletCF = CF(Origin, Origin + Direction)
  1975. local Bullet = Instance.new("Part")
  1976. Bullet.BrickColor = S.bulletSettings.Color
  1977. Bullet.Material = Enum.Material.Neon
  1978. Bullet.Name = "Bullet"
  1979. Bullet.CanCollide = false
  1980. Bullet.FormFactor = "Custom"
  1981. Bullet.Size = S.bulletSettings.Size
  1982. Bullet.BottomSurface = "Smooth"
  1983. Bullet.TopSurface = "Smooth"
  1984. if math.min(S.bulletSettings.Size.X, S.bulletSettings.Size.Y, S.bulletSettings.Size.Z) < 0.2 then
  1985. local Mesh = Instance.new("BlockMesh")
  1986. Mesh.Scale = S.bulletSettings.Size / Vector3.new(
  1987. math.max(S.bulletSettings.Size.X, 0.2),
  1988. math.max(S.bulletSettings.Size.Y, 0.2),
  1989. math.max(S.bulletSettings.Size.Z, 0.2)
  1990. )
  1991. Mesh.Parent = Bullet
  1992. end
  1993. local BF = Instance.new("BodyForce")
  1994. BF.force = V3(0, Bullet:GetMass() * (196.2 - S.bulletSettings.Acceleration), 0)
  1995. BF.Parent = Bullet
  1996. Bullet.Parent = gunIgnore
  1997. Bullet.CFrame = bulletCF + Direction * S.bulletSettings.Size.Z / 2
  1998. Bullet.Velocity = Direction * S.bulletSettings.Velocity
  1999. return Bullet
  2000. end
  2001.  
  2002. --------------------[ HIT HANDLING FUNCTIONS ]----------------------------------------
  2003.  
  2004. function getBaseDamage(Dist)
  2005. local startDmg = S.damageSettings.Start.Damage
  2006. local startDist = S.damageSettings.Start.Dist
  2007. local endDmg = S.damageSettings.End.Damage
  2008. local endDist = S.damageSettings.End.Dist
  2009. return (
  2010. (
  2011. Dist < startDist * S.bulletSettings.Range
  2012. ) and startDmg or
  2013. (
  2014. Dist >= startDist * S.bulletSettings.Range and
  2015. Dist < endDist * S.bulletSettings.Range
  2016. ) and numLerp(startDmg, endDmg, Map(Dist / S.bulletSettings.Range, startDist, endDist, 0, 1)) or
  2017. (
  2018. Dist >= endDist * S.bulletSettings.Range
  2019. ) and endDmg
  2020. )
  2021. end
  2022.  
  2023. function Damage(H, P, N, D, Dist, customIgnore)
  2024. local hVal = S.damageSettings.Multipliers.Head
  2025. local cVal = S.damageSettings.Multipliers.Chest
  2026. local lVal = S.damageSettings.Multipliers.Limbs
  2027. local baseDamage = getBaseDamage(Dist)
  2028. if Humanoid.Health ~= 0 then
  2029. local hitHumanoid = nil
  2030. if H.Parent:IsA("Hat") then
  2031. table.insert(customIgnore, H)
  2032. local newRay = Ray.new(P - D * 0.1, D * (S.bulletSettings.Range - Dist + 0.1))
  2033. local newH, newP, newN = workspace:FindPartOnRayWithIgnoreList(newRay, customIgnore)
  2034. if newH then
  2035. hitHumanoid = Damage(newH, newP, newN, D, Dist + (newP - P).magnitude, customIgnore)
  2036. end
  2037. else
  2038. hitHumanoid = findFirstClass(H.Parent, "Humanoid")
  2039. if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) then
  2040. local Tag = Instance.new("ObjectValue")
  2041. Tag.Value = Player
  2042. Tag.Name = "creator"
  2043. Tag.Parent = hitHumanoid
  2044. DS:AddItem(Tag, 0.3)
  2045. local chosenDamage = 0
  2046. if H.Name == "Head" then
  2047. chosenDamage = baseDamage * RAND(hVal, hVal + 0.1, 0.01)
  2048. elseif H.Name == "Torso" then
  2049. chosenDamage = baseDamage * RAND(cVal, cVal + 0.1, 0.01)
  2050. else
  2051. chosenDamage = baseDamage * RAND(lVal, lVal + 0.1, 0.01)
  2052. end
  2053. hitHumanoid:TakeDamage(chosenDamage)
  2054. markHit()
  2055. end
  2056. end
  2057. return hitHumanoid
  2058. end
  2059. end
  2060.  
  2061. function isWallIgnored(Wall)
  2062. return (
  2063. Wall.Transparency >= S.penetrationSettings.transparencyThreshold or
  2064. (S.penetrationSettings.ignoreNonCanCollide and (not Wall.CanCollide)) or
  2065. isIgnored(Wall, S.penetrationSettings.ignoreCustom)
  2066. )
  2067. end
  2068.  
  2069. function penetrateWall(Wall, hitPos, Direction, Normal, Ignore, totalPDist, totalBDist, lastDamagedHumanoid)
  2070. local wallIgnore = isWallIgnored(Wall)
  2071. local hitHumanoid = (Wall.Parent:IsA("Hat") and findFirstClass(Wall.Parent.Parent, "Humanoid") or findFirstClass(Wall.Parent, "Humanoid"))
  2072. local damagedHumanoid = nil
  2073. if hitHumanoid and hitHumanoid ~= lastDamagedHumanoid then
  2074. lastDamagedHumanoid = hitHumanoid
  2075. damagedHumanoid = Damage(Wall, hitPos, Normal, Direction, totalBDist, {Char, ignoreModel})
  2076. else
  2077. lastDamagedHumanoid = nil
  2078. end
  2079. local ignoreObject = hitHumanoid and (Wall.Parent:IsA("Hat") and Wall.Parent.Parent or Wall.Parent) or Wall
  2080. table.insert(Ignore, ignoreObject)
  2081. local rayLength = S.bulletSettings.Range - totalBDist
  2082. local testRay = Ray.new(hitPos, Direction * (S.bulletSettings.Range - totalBDist))
  2083. local H1, P1, N1 = workspace:FindPartOnRayWithIgnoreList(testRay, Ignore)
  2084. local newIgnore = removeElement(Ignore, ignoreObject)
  2085. local wallRay = Ray.new(P1 + Direction * 0.1, -Direction * (rayLength + 1))
  2086. local H2, P2, N2 = workspace:FindPartOnRayWithIgnoreList(wallRay, Ignore)
  2087. local newPDist = totalPDist + (wallIgnore and 0 or (getNearestPoint(P1, P2, hitPos) - hitPos).magnitude)
  2088. local newBDist = totalBDist + (P1 - hitPos).magnitude
  2089. local outOfRange = Round(newPDist, 0.001) > S.penetrationSettings.Dist or Round(newBDist, 0.001) > S.bulletSettings.Range
  2090. if (not wallIgnore) then
  2091. createBulletImpact:FireServer(Wall, hitPos, Normal, Direction, hitHumanoid, gunIgnore, S)
  2092. if (not hitHumanoid) then
  2093. createShockwave:FireServer(hitPos, S.shockwaveSettings.Radius, gunIgnore, S)
  2094. end
  2095. end
  2096. if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) and hitHumanoid == damagedHumanoid then
  2097. createBlood:FireServer(Wall, P2, Direction, gunIgnore, S)
  2098. end
  2099. if outOfRange or (not H1) then
  2100. if (not outOfRange) and (not wallIgnore) then
  2101. createBulletImpact:FireServer(Wall, P2, N2, Direction, hitHumanoid, gunIgnore, S)
  2102. if (not hitHumanoid) then
  2103. createShockwave:FireServer(P2, S.shockwaveSettings.Radius, gunIgnore, S)
  2104. end
  2105. end
  2106. return Wall, hitPos
  2107. else
  2108. if Wall == H2 and (not wallIgnore) then
  2109. createBulletImpact:FireServer(Wall, P2, N2, Direction, hitHumanoid, gunIgnore, S)
  2110. if (not hitHumanoid) then
  2111. createShockwave:FireServer(P2, S.shockwaveSettings.Radius, gunIgnore, S)
  2112. end
  2113. end
  2114. return penetrateWall(H1, P1, Direction, N1, Ignore, newPDist, newBDist, lastDamagedHumanoid)
  2115. end
  2116. end
  2117.  
  2118. function PenetrateWall(HitPos, Direction, HitHumanoid, OriginPos, Bullet, CurrentPDist)
  2119. local HitDist = (HitPos - OriginPos).magnitude
  2120. local Wall, WallHitPos = nil, nil
  2121. local Hum, HumHitPos = nil, nil
  2122. local CustomIgnore = {unpack(Ignore)}
  2123. for i = 1, 10 do
  2124. local WallRay = Ray.new(HitPos - (Direction * 0.1), Direction * S.Penetration)
  2125. local H, P = game.Workspace:FindPartOnRayWithIgnoreList(WallRay, CustomIgnore)
  2126. if H then
  2127. local HitHumanoid = nil
  2128. if H.Parent.ClassName == "Hat" then
  2129. HitHumanoid = findFirstClass(H.Parent.Parent, "Humanoid")
  2130. else
  2131. HitHumanoid = findFirstClass(H.Parent, "Humanoid")
  2132. end
  2133. if HitHumanoid and i ~= 1 then
  2134. Hum, HumHitPos = H, P
  2135. break
  2136. else
  2137. Wall, WallHitPos = H, P
  2138. table.insert(CustomIgnore, H)
  2139. end
  2140. else
  2141. break
  2142. end
  2143. end
  2144. if Wall then
  2145. if S.InstantHit then
  2146. if Hum then
  2147. Damage(Hum.Parent:FindFirstChild("Head"), HumHitPos)
  2148. return HumHitPos
  2149. else
  2150. local HitObj2, HitPos2 = nil, nil
  2151. if HitHumanoid then
  2152. HitObj2, HitPos2 = AdvRayCast(WallHitPos, Direction, S.BulletRange - HitDist, {Wall, HitHumanoid.Parent, unpack(Ignore)})
  2153. else
  2154. HitObj2, HitPos2 = AdvRayCast(WallHitPos, Direction, S.BulletRange - HitDist, {Wall, unpack(Ignore)})
  2155. end
  2156. Damage(HitObj2, HitPos2)
  2157.  
  2158. local NewPDist = CurrentPDist + (WallHitPos - HitPos).magnitude
  2159. local NewHitPos2 = HitPos2
  2160. if NewPDist < S.Penetration and HitObj2 then
  2161. NewHitPos2 = PenetrateWall(HitPos2, Direction, HitHumanoid, OriginPos, Bullet, CurrentPDist + NewPDist)
  2162. end
  2163. return NewHitPos2
  2164. end
  2165. else
  2166. local LastPos = WallHitPos
  2167. local TotalDistTraveled = 0
  2168. spawn(function()
  2169. if Hum then
  2170. Damage(Hum.Parent:FindFirstChild("Head"), HumHitPos)
  2171. return HumHitPos
  2172. else
  2173. while true do
  2174. RS.RenderStepped:wait()
  2175. if TotalDistTraveled >= S.BulletRange - HitDist then
  2176. Bullet:Destroy()
  2177. break
  2178. end
  2179. local DistTraveled = (Bullet.Position - LastPos).magnitude
  2180. local NewDirection = (Bullet.Position - LastPos).unit
  2181. local TempHitObj, TempHitPos = nil, nil
  2182. if HitHumanoid then
  2183. TempHitObj, TempHitPos = AdvRayCast(LastPos, NewDirection, DistTraveled, {Wall, HitHumanoid.Parent, unpack(Ignore)})
  2184. else
  2185. TempHitObj, TempHitPos = AdvRayCast(LastPos, NewDirection, DistTraveled, {Wall, unpack(Ignore)})
  2186. end
  2187. if TempHitObj then
  2188. Damage(TempHitObj, TempHitPos)
  2189.  
  2190. local NewPDist = CurrentPDist + (WallHitPos - HitPos).magnitude
  2191. local NewTempPos = TempHitPos
  2192. if NewPDist < S.Penetration and TempHitObj then
  2193. NewTempPos = PenetrateWall(TempHitPos, Direction, HitHumanoid, OriginPos, Bullet, CurrentPDist + NewPDist)
  2194. else
  2195. Bullet:Destroy()
  2196. end
  2197. return NewTempPos
  2198. else
  2199. LastPos = Bullet.Position
  2200. TotalDistTraveled = TotalDistTraveled + DistTraveled
  2201. end
  2202. end
  2203. end
  2204. end)
  2205. end
  2206. else
  2207. if Bullet then Bullet:Destroy() end
  2208. return HitPos
  2209. end
  2210. end
  2211.  
  2212. function isEnemy(Human)
  2213. local Plyr = game.Players:GetPlayerFromCharacter(Human.Parent)
  2214. if (not Plyr) then return S.CanDamageNPCs end
  2215. return S.AllowFriendlyFire or (Plyr.TeamColor ~= Player.TeamColor or Plyr.Neutral)
  2216. end
  2217.  
  2218. --------------------[ RELOAD FUNCTIONS ]----------------------------------------------
  2219.  
  2220. function animateReload()
  2221. tweenJoint(LWeld2, CF(), CF(), Sine, 0.15)
  2222. tweenJoint(RWeld2, CF(), CF(), Sine, 0.15)
  2223. local magParts = {}
  2224. local magTable = {}
  2225.  
  2226. for _, Obj in pairs(Gun:GetChildren()) do
  2227. if string.sub(Obj.Name, 1, 3) == "Mag" and Obj:IsA("BasePart") then
  2228. INSERT(magParts, Obj)
  2229. end
  2230. end
  2231.  
  2232. local animVars = {
  2233. --FUNCTIONS--
  2234. tweenJoint = tweenJoint;
  2235.  
  2236. makeMagInvisible = function()
  2237. for _, v in pairs(magParts) do
  2238. v.Transparency = 1
  2239. end
  2240. magVisible = false
  2241. end;
  2242.  
  2243. makeMagVisible = function()
  2244. for _, v in pairs(magParts) do
  2245. v.Transparency = v:WaitForChild("magTrans").Value
  2246. end
  2247. magVisible = true
  2248. end;
  2249.  
  2250. isMagVisible = function()
  2251. return magVisible
  2252. end;
  2253.  
  2254. isMagEmpty = function()
  2255. return ammoInClip == 0
  2256. end;
  2257.  
  2258. setNewMag = function()
  2259. newMag = true
  2260. end;
  2261.  
  2262. isNewMag = function()
  2263. return newMag
  2264. end;
  2265.  
  2266. createMag = function(Key)
  2267. local magModel = Instance.new("Model")
  2268. local magClones = {}
  2269. for i, v in pairs(magParts) do
  2270. local vClone = v:Clone()
  2271. vClone.Transparency = v:WaitForChild("magTrans").Value
  2272. vClone.CanCollide = false
  2273. vClone.Parent = magModel
  2274. INSERT(magClones, {Original = v, magClone = vClone})
  2275. if i ~= 1 then
  2276. local W = Instance.new("Weld")
  2277. W.Part0 = magClones[1].magClone
  2278. W.Part1 = vClone
  2279. W.C0 = magClones[1].magClone.CFrame:toObjectSpace(vClone.CFrame)
  2280. W.Parent = magClones[1].magClone
  2281. end
  2282. end
  2283. magTable[Key] = {magModel, magClones}
  2284. return magModel, magClones
  2285. end;
  2286.  
  2287. getMag = function(Key)
  2288. if magTable[Key] then
  2289. return magTable[Key][1], magTable[Key][2]
  2290. else
  2291. return nil, nil
  2292. end
  2293. end;
  2294.  
  2295. attachGripToHead = function()
  2296. local handleCF = RArm.CFrame * Grip.C0
  2297. Grip.C0 = Head.CFrame:toObjectSpace(handleCF)
  2298. Grip.Part0 = Head
  2299. end;
  2300.  
  2301. attachGripToArm = function()
  2302. local handleCF = Head.CFrame * Grip.C0
  2303. Grip.C0 = RArm.CFrame:toObjectSpace(handleCF)
  2304. Grip.Part0 = RArm
  2305. end;
  2306.  
  2307. Sine = Sine;
  2308.  
  2309. Linear = Linear;
  2310.  
  2311. --VARIABLES--
  2312. Handle = Handle;
  2313. LArm = LArm;
  2314. RArm = RArm;
  2315. LWeld = LWeld;
  2316. RWeld = RWeld;
  2317. LC0 = armC0[1];
  2318. RC0 = armC0[2];
  2319. Grip = Grip;
  2320. gunIgnore = gunIgnore;
  2321. Cam = Cam;
  2322. CF = CF;
  2323. CFANG = CFANG;
  2324. V3 = V3;
  2325. RAD = RAD;
  2326. reloadTimeLoaded = S.reloadSettings.Times.Loaded;
  2327. reloadTimeEmpty = S.reloadSettings.Times.Empty
  2328. }
  2329.  
  2330. local sequenceTable = Anims.Reload(animVars)
  2331. --local T = tick()
  2332. for _, reloadFunction in pairs(sequenceTable) do
  2333. if breakReload then
  2334. break
  2335. end
  2336. reloadFunction()
  2337.  
  2338. if (not magVisible) then
  2339. Ammo.Value = 0
  2340. end
  2341. updateClipAmmo()
  2342. end
  2343. --print(tick() - T) --I divide the reloadTime by this number to get the animation speed
  2344.  
  2345. if (not isCrawling) then
  2346. if Running and (not S.canFireWhileRunning) then
  2347. tweenJoint(LWeld, armC0[1], S.runningC1.leftArm, Sine, 0.4)
  2348. tweenJoint(RWeld, armC0[2], S.runningC1.rightArm, Sine, 0.4)
  2349. tweenJoint(Grip, nil, S.runningC1.Grip, Sine, 0.4)
  2350. else
  2351. tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, 0.4)
  2352. tweenJoint(RWeld, armC0[2], S.unAimedC1.rightArm, Sine, 0.4)
  2353. tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, 0.4)
  2354. end
  2355. end
  2356.  
  2357. for _, v in pairs(magTable) do --In case the reload animations was stopped mid way and there were still fake mags that weren't deleted
  2358. v[1]:Destroy()
  2359. end
  2360. end
  2361.  
  2362. function Reload()
  2363. if Ammo.Value < (ClipSize.Value + 1) and (not Reloading) and StoredAmmo.Value > 0 then
  2364. Firing = false
  2365. ammoInClip = (ammoInClip == 0 and Ammo.Value or ammoInClip)
  2366. Reloading = true
  2367. lowerSpread()
  2368. if Aimed then unAimGun(S.reloadSettings.Anim) end
  2369. crossHair.Reload.Visible = true
  2370. if Handle:FindFirstChild("ReloadSound") then Handle.ReloadSound:Play() end
  2371. if S.reloadSettings.Anim then
  2372. wait()
  2373. animateReload()
  2374. else
  2375. local startReload = tick()
  2376. local initialReloadTime = Ammo.Value == 0 and S.reloadSettings.Times.Empty or S.reloadSettings.Times.Loaded
  2377. while true do
  2378. if breakReload then break end
  2379. if (tick() - startReload) >= initialReloadTime then break end
  2380. RS.RenderStepped:wait()
  2381. end
  2382. end
  2383. if (not breakReload) then
  2384. newMag = false
  2385. if StoredAmmo.Value >= ClipSize.Value then
  2386. if ammoInClip > 0 then
  2387. StoredAmmo.Value = StoredAmmo.Value - ((ClipSize.Value + 1) - ammoInClip)
  2388. Ammo.Value = ClipSize.Value + 1
  2389. else
  2390. StoredAmmo.Value = StoredAmmo.Value - ClipSize.Value
  2391. Ammo.Value = ClipSize.Value
  2392. end
  2393. elseif StoredAmmo.Value < ClipSize.Value and StoredAmmo.Value > 0 then
  2394. Ammo.Value = StoredAmmo.Value
  2395. StoredAmmo.Value = 0
  2396. end
  2397. end
  2398. Reloading = false
  2399. if Selected then
  2400. ammoInClip = (breakReload and ammoInClip or 0)
  2401. crossHair.Reload.Visible = false
  2402. end
  2403. breakReload = false
  2404. end
  2405.  
  2406. updateClipAmmo()
  2407. updateStoredAmmo()
  2408. end
  2409.  
  2410. --------------------[ EXTERNAL DATA LOCATING FUNCTIONS ]-----------------------------
  2411.  
  2412. function removeElement(Table, Element) --removes the first instance of Element from Table
  2413. for i, v in pairs(Table) do
  2414. if v == Element then
  2415. table.remove(Table, i)
  2416. break
  2417. end
  2418. end
  2419. return Table
  2420. end
  2421.  
  2422. function findFirstClass(Object, Class)
  2423. local foundObject = nil
  2424. for _, Obj in pairs(Object:GetChildren()) do
  2425. if Obj.ClassName == Class then
  2426. foundObject = Obj
  2427. break
  2428. end
  2429. end
  2430. return foundObject
  2431. end
  2432.  
  2433. function isIgnored(Obj, Table)
  2434. for _,v in pairs(Table) do
  2435. if Obj == v or Obj:IsDescendantOf(v) then
  2436. return true
  2437. end
  2438. end
  2439. return false
  2440. end
  2441.  
  2442. function GetHitSurfaceCFrame(HitPos,Obj)
  2443. local SurfaceCF = {
  2444. {"Back",Obj.CFrame * CF(0,0,Obj.Size.z)};
  2445. {"Bottom",Obj.CFrame * CF(0,-Obj.Size.y,0)};
  2446. {"Front",Obj.CFrame * CF(0,0,-Obj.Size.z)};
  2447. {"Left",Obj.CFrame * CF(-Obj.Size.x,0,0)};
  2448. {"Right",Obj.CFrame * CF(Obj.Size.x,0,0)};
  2449. {"Top",Obj.CFrame * CF(0,Obj.Size.y,0)}
  2450. }
  2451. local ClosestDist = HUGE
  2452. local ClosestSurface = nil
  2453. for _,v in pairs(SurfaceCF) do
  2454. local SurfaceDist = (HitPos - v[2].p).magnitude
  2455. if SurfaceDist < ClosestDist then
  2456. ClosestDist = SurfaceDist
  2457. ClosestSurface = v
  2458. end
  2459. end
  2460. return ClosestSurface[2]
  2461. end
  2462.  
  2463. function AdvRayCast(Origin, Direction, Dist, CustomIgnore)
  2464. local NewIgnore = (CustomIgnore and CustomIgnore or Ignore)
  2465. local NewRay = Ray.new(Origin, Direction * (Dist > 999 and 999 or Dist))
  2466. local HitObj, HitPos = game.Workspace:FindPartOnRayWithIgnoreList(NewRay, NewIgnore)
  2467. local LastPos = HitPos
  2468. local FinalHitObj, FinalHitPos = nil, nil
  2469. local RepTimes = math.floor(Dist / 999)
  2470. if (not HitObj) and (Dist > 999) then
  2471. for i = 0, RepTimes do
  2472. local NewDist = (i == RepTimes and (Dist - (LastPos - Origin).magnitude) or 999)
  2473. local Ray2 = Ray.new(LastPos, Direction * NewDist)
  2474. local HitObj2, HitPos2 = game.Workspace:FindPartOnRayWithIgnoreList(Ray2, NewIgnore)
  2475. if i ~= RepTimes then
  2476. if HitObj2 then
  2477. FinalHitObj, FinalHitPos = HitObj2, HitPos2
  2478. break
  2479. end
  2480. elseif i == RepTimes then
  2481. FinalHitObj, FinalHitPos = HitObj2, HitPos2
  2482. end
  2483. LastPos = HitPos2
  2484. end
  2485. return FinalHitObj, FinalHitPos
  2486. elseif HitObj or (Dist <= 999) then
  2487. return HitObj, HitPos
  2488. end
  2489. end
  2490.  
  2491. --------------------[ JUMPING ANIMATION ]---------------------------------------------
  2492.  
  2493. function onFall(initialVelocity)
  2494. spawn(function()
  2495. local velocityAlpha = math.max(math.min(initialVelocity / Humanoid.JumpPower, 1), 0)
  2496. local startJumpPos = jumpAnim.Pos
  2497. local startJumpRot = jumpAnim.Rot
  2498. local endJumpPos = 0.04 * S.fallSettings.fallMultiplier * velocityAlpha
  2499. local endJumpRot = RAD(4) * S.fallSettings.fallMultiplier * velocityAlpha
  2500. local t0 = tick()
  2501. while true do
  2502. RS.Heartbeat:wait()
  2503. local Alpha = math.min((tick() - t0) / 0.15, 1) * 90
  2504. if onGround then break end
  2505. jumpAnim.Pos = numLerp(startJumpPos, endJumpPos, Sine(Alpha))
  2506. jumpAnim.Rot = numLerp(startJumpRot, endJumpRot, Sine(Alpha))
  2507. if Alpha == 90 then break end
  2508. end
  2509. startJumpPos = endJumpPos
  2510. startJumpRot = endJumpRot
  2511. endJumpPos = -0.08 * S.fallSettings.fallMultiplier
  2512. endJumpRot = -RAD(8) * S.fallSettings.fallMultiplier
  2513. local X = 1
  2514. while true do
  2515. local dt = RS.Heartbeat:wait()
  2516. X = X + (dt * 60) / X
  2517. local Alpha = (X - 1) / 15
  2518. if onGround then break end
  2519. jumpAnim.Pos = numLerp(startJumpPos, endJumpPos, Alpha)
  2520. jumpAnim.Rot = numLerp(startJumpRot, endJumpRot, Alpha)
  2521. end
  2522. end)
  2523. end
  2524.  
  2525. function onLand(fallDist)
  2526. spawn(function()
  2527. local animAlpha = math.min(fallDist, S.fallSettings.maxDist) * (2 / 3)
  2528. local startJumpPos = jumpAnim.Pos
  2529. local startJumpRot = jumpAnim.Rot
  2530. local endJumpPos = animAlpha / 100 * S.fallSettings.landMultiplier * (runReady and 1 or 2)
  2531. local endJumpRot = RAD(animAlpha) * S.fallSettings.landMultiplier * (runReady and 1 or 2)
  2532. local t0 = tick()
  2533. while true do
  2534. RS.Heartbeat:wait()
  2535. local Alpha = math.min((tick() - t0) / 0.2, 1)
  2536. if (not onGround) then break end
  2537. jumpAnim.Pos = numLerp(startJumpPos, endJumpPos, Alpha)
  2538. jumpAnim.Rot = numLerp(startJumpRot, endJumpRot, Alpha)
  2539. if Alpha == 1 then break end
  2540. end
  2541. t0 = tick()
  2542. while true do
  2543. RS.Heartbeat:wait()
  2544. local Alpha = math.min((tick() - t0) / 0.3, 1) * 90
  2545. if (not onGround) then break end
  2546. jumpAnim.Pos = numLerp(endJumpPos, 0, Sine(Alpha))
  2547. jumpAnim.Rot = numLerp(endJumpRot, 0, Sine(Alpha))
  2548. if Alpha == 90 then break end
  2549. end
  2550. end)
  2551. end
  2552.  
  2553. function onHumanoidStateChanged(oldState, newState)
  2554. if newState == Enum.HumanoidStateType.Freefall then
  2555. onGround = false
  2556. if S.fallAnimation then
  2557. onFall(HRP.Velocity.Y)
  2558. while HRP.Velocity.Y > 0 do RS.RenderStepped:wait() end
  2559. startFallHeight = HRP.Position.Y
  2560. end
  2561. elseif oldState == Enum.HumanoidStateType.Freefall then
  2562. onGround = true
  2563. if S.fallAnimation then
  2564. local fallDist = startFallHeight - HRP.Position.Y
  2565. onLand(fallDist)
  2566. end
  2567. end
  2568. end
  2569. --------------------[ CAMERA STEADYING FUNCTIONS ]------------------------------------
  2570.  
  2571. function steadyCamera()
  2572. scopeSteady.Text = "Steadying..."
  2573. scopeSteady.TextColor3 = Color3.new(1, 1, 0)
  2574. camSteady = true
  2575. local originalSway = camSway
  2576. local Increment = 1.5 / 0.6
  2577. local X = 0
  2578. while true do
  2579. RS.RenderStepped:wait()
  2580. local newX = X + Increment
  2581. X = (newX > 90 and 90 or newX)
  2582. if (not steadyKeyPressed) then break end
  2583. camSway = numLerp(originalSway, 0, Sine(X))
  2584. if X == 90 then break end
  2585. end
  2586. while steadyKeyPressed and Aimed do
  2587. if currentSteadyTime > 0 then
  2588. local NewSteadyTime = currentSteadyTime - 1
  2589. currentSteadyTime = (NewSteadyTime < 0 and 0 or NewSteadyTime)
  2590. camSway = 0
  2591. elseif currentSteadyTime == 0 then
  2592. break
  2593. end
  2594. RS.RenderStepped:wait()
  2595. end
  2596. camSteady = false
  2597. spawn(function()
  2598. local Increment = 1.5 / 0.25
  2599. local X = 0
  2600. while true do
  2601. RS.RenderStepped:wait()
  2602. local newX = X + Increment
  2603. X = (newX > 90 and 90 or newX)
  2604. if camSteady then break end
  2605. camSway = numLerp(0, S.scopeSettings.camSwayOnBreath, 1 - COS(RAD(X)))
  2606. if X == 90 then break end
  2607. end
  2608. Increment = 1.5 / S.scopeSettings.breathTime
  2609. X = 0
  2610. while true do
  2611. RS.RenderStepped:wait()
  2612. local newX = X + Increment
  2613. X = (newX > 90 and 90 or newX)
  2614. if camSteady then break end
  2615. camSway = numLerp(S.scopeSettings.camSwayOnBreath, 1, Sine(X))
  2616. if X == 90 then break end
  2617. end
  2618. --[[for X = 0, 90, 1.5 / 0.2 do
  2619. local Alpha = 1 - COS(RAD(X))--math.log10(X) / math.log10(90)
  2620. camSway = numLerp(0, 3, Alpha)
  2621. RS.RenderStepped:wait()
  2622. end]]
  2623. --[[for X = 0, 90, 1.5 / S.scopeSettings.steadyTime do
  2624. if camSteady then break end
  2625. local Alpha = SIN(RAD(X))
  2626. camSway = numLerp(3, 1, Alpha)
  2627. RS.RenderStepped:wait()
  2628. end]]
  2629. end)
  2630. retakeBreath()
  2631. end
  2632.  
  2633. function retakeBreath()
  2634. scopeSteady.Text = "Re-taking Breath"
  2635. scopeSteady.TextColor3 = Color3.new(1, 0, 0)
  2636. takingBreath = true
  2637. local Increment = S.scopeSettings.steadyTime / S.scopeSettings.breathTime
  2638. while takingBreath do
  2639. if currentSteadyTime < maxSteadyTime then
  2640. local newSteadyTime = currentSteadyTime + Increment
  2641. currentSteadyTime = (newSteadyTime > maxSteadyTime and maxSteadyTime or newSteadyTime)
  2642. elseif currentSteadyTime >= maxSteadyTime then
  2643. break
  2644. end
  2645. RS.RenderStepped:wait()
  2646. end
  2647. if takingBreath then
  2648. scopeSteady.Text = "Hold "..convertKey(S.Keys.scopeSteady).." to Steady"
  2649. scopeSteady.TextColor3 = Color3.new(1, 1, 0)
  2650. takingBreath = false
  2651. end
  2652. end
  2653.  
  2654. --------------------[ SPRINTING FUNCTIONS ]-------------------------------------------
  2655.  
  2656. function canRun(midRun)
  2657. return ((Forward and (not Backward)) and
  2658. Walking and (Stamina > 0) and Running and
  2659. Selected and (midRun and true or onGround) and
  2660. runReady and (S.canFireWhileRunning and true or (not Firing))
  2661. )
  2662. end
  2663.  
  2664. function monitorStamina()
  2665. Running = true
  2666. if (not canRun(false)) then
  2667. Running = false
  2668. return
  2669. end
  2670. if Aimed then unAimGun(true) end
  2671. if Stance == 1 or Stance == 2 then Stand() end
  2672. if (not (Reloading and S.reloadSettings.Anim)) then
  2673. if S.canFireWhileRunning then
  2674. tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, 0.4)
  2675. tweenJoint(RWeld, armC0[2], S.unAimedC1.rightArm, Sine, 0.4)
  2676. tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, 0.4)
  2677. else
  2678. tweenJoint(LWeld, armC0[1], S.runningC1.leftArm, Sine, 0.4)
  2679. tweenJoint(RWeld, armC0[2], S.runningC1.rightArm, Sine, 0.4)
  2680. tweenJoint(Grip, nil, S.runningC1.Grip, Sine, 0.4)
  2681. end
  2682. end
  2683. crossOffset = 50
  2684. while runKeyPressed do
  2685. if canRun(true) then
  2686. if onGround then
  2687. local newStamina = Stamina - 1
  2688. Stamina = (newStamina < 0 and 0 or newStamina)
  2689. end
  2690. else
  2691. break
  2692. end
  2693. RS.RenderStepped:wait()
  2694. end
  2695. Running = false
  2696. if (not Aimed) and (not (Reloading and S.reloadSettings.Anim)) and (not S.canFireWhileRunning) then
  2697. crossOffset = 0
  2698. tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, 0.4)
  2699. tweenJoint(RWeld, armC0[2], S.unAimedC1.rightArm, Sine, 0.4)
  2700. tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, 0.4)
  2701. end
  2702.  
  2703. rechargeStamina()
  2704. end
  2705.  
  2706. function rechargeStamina()
  2707. chargingStamina = true
  2708. while ((not runKeyPressed) or (Stamina < maxStamina)) and (not Running) do
  2709. if Stamina < maxStamina then
  2710. local newStamina = Stamina + (S.sprintTime / S.staminaCoolTime)
  2711. Stamina = (newStamina > maxStamina and maxStamina or newStamina)
  2712. elseif Stamina >= maxStamina then
  2713. break
  2714. end
  2715. RS.RenderStepped:wait()
  2716. end
  2717. chargingStamina = false
  2718. end
  2719.  
  2720. --------------------[ STANCE FUNCTIONS ]----------------------------------------------
  2721.  
  2722. function Stand(onDeselected)
  2723. local LHip = Torso["Left Hip"]
  2724. local RHip = Torso["Right Hip"]
  2725. LLegWeld.Part1 = nil
  2726. LHip.Part1 = LLeg
  2727. RLegWeld.Part1 = nil
  2728. RHip.Part1 = RLeg
  2729. Stance = 0
  2730. spreadStance = "Stand"
  2731. baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
  2732. if S.stanceSettings.Anim and (not onDeselected) then
  2733. spawn(function()
  2734. local prevStanceSway = stanceSway
  2735. local X = 0
  2736. local Increment = 1.5 / S.stanceSettings.Speed
  2737. while true do
  2738. RS.RenderStepped:wait()
  2739. local newX = X + Increment
  2740. X = (newX > 90 and 90 or newX)
  2741. if Stance ~= 0 then break end
  2742. stanceSway = numLerp(prevStanceSway, 1, Sine(X))
  2743. if X == 90 then break end
  2744. end
  2745. end)
  2746. tweenJoint(ABWeld, CF(), nil, Sine, S.stanceSettings.Speed)
  2747. tweenJoint(LLegWeld, legC0.Stand[1], nil, Sine, S.stanceSettings.Speed)
  2748. tweenJoint(RLegWeld, legC0.Stand[2], nil, Sine, S.stanceSettings.Speed)
  2749. tweenJoint(LHip, CF(-1, -1, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0), Sine, S.stanceSettings.Speed)
  2750. tweenJoint(RHip, CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0), Sine, S.stanceSettings.Speed)
  2751. tweenJoint(Root, CFANG(RAD(-90), 0, RAD(180)), nil, Sine, S.stanceSettings.Speed)
  2752. tweenJoint(headWeld, CF(0, 1.5, 0), nil, Sine, S.stanceSettings.Speed)
  2753. elseif onDeselected or (not S.stanceSettings.Anim) then
  2754. ABWeld.C0 = CF()
  2755. LLegWeld.C0 = legC0.Stand[1]
  2756. RLegWeld.C0 = legC0.Stand[2]
  2757. LHip.C0, LHip.C1 = CF(-1, -1, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0)
  2758. RHip.C0, RHip.C1 = CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0)
  2759. Root.C0 = CFANG(RAD(-90), 0, RAD(180))
  2760. headWeld.C0 = CF(0, 1.5, 0)
  2761. end
  2762. end
  2763.  
  2764. function Crouch()
  2765. local LHip = Torso["Left Hip"]
  2766. local RHip = Torso["Right Hip"]
  2767. LHip.Part1 = nil
  2768. LLegWeld.Part1 = LLeg
  2769. RHip.Part1 = nil
  2770. RLegWeld.Part1 = RLeg
  2771. Stance = 1
  2772. spreadStance = "Crouch"
  2773. baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
  2774. if S.stanceSettings.Anim then
  2775. spawn(function()
  2776. local prevStanceSway = stanceSway
  2777. local X = 0
  2778. local Increment = 1.5 / S.stanceSettings.Speed
  2779. while true do
  2780. RS.RenderStepped:wait()
  2781. local newX = X + Increment
  2782. X = (newX > 90 and 90 or newX)
  2783. if Stance ~= 1 then break end
  2784. stanceSway = numLerp(prevStanceSway, 0.75, Sine(X))
  2785. if X == 90 then break end
  2786. end
  2787. end)
  2788. tweenJoint(ABWeld, CF(0, 0, -0.05), nil, Sine, S.stanceSettings.Speed)
  2789. tweenJoint(LLegWeld, legC0.Crouch[1], nil, Sine, S.stanceSettings.Speed)
  2790. tweenJoint(RLegWeld, legC0.Crouch[2], nil, Sine, S.stanceSettings.Speed)
  2791. tweenJoint(LHip, CF(-1, -0.5, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 0.5, 1) * CFANG(0, RAD(-90), RAD(-90)), Sine, S.stanceSettings.Speed)
  2792. tweenJoint(RHip, CF(1, -0.5, 0.25) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 0.5, 1) * CFANG(RAD(-180), RAD(90), 0), Sine, S.stanceSettings.Speed)
  2793. tweenJoint(Root, CF(0, -1, 0) * CFANG(RAD(-90), 0, RAD(180)), nil, Sine, S.stanceSettings.Speed)
  2794. tweenJoint(headWeld, CF(0, 1.5, 0), nil, Sine, S.stanceSettings.Speed)
  2795. else
  2796. ABWeld.C0 = CF(0, 0, -1 / 16)
  2797. LLegWeld.C0 = legC0.Crouch[1]
  2798. RLegWeld.C0 = legC0.Crouch[2]
  2799. LHip.C0, LHip.C1 = CF(-1, -0.5, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 0.5, 1) * CFANG(0, RAD(-90), RAD(-90))
  2800. RHip.C0, RHip.C1 = CF(1, -0.5, 0.25) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 0.5, 1) * CFANG(RAD(-180), RAD(90), 0)
  2801. Root.C0 = CF(0, -1, 0) * CFANG(RAD(-90), 0, RAD(180))
  2802. headWeld.C0 = CF(0, 1.5, 0)
  2803. end
  2804. end
  2805.  
  2806. function Prone()
  2807. local LHip = Torso["Left Hip"]
  2808. local RHip = Torso["Right Hip"]
  2809. LHip.Part1 = nil
  2810. LLegWeld.Part1 = LLeg
  2811. RHip.Part1 = nil
  2812. RLegWeld.Part1 = RLeg
  2813. Stance = 2
  2814. spreadStance = "Prone"
  2815. baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
  2816. if S.stanceSettings.Anim then
  2817. spawn(function()
  2818. local prevStanceSway = stanceSway
  2819. local X = 0
  2820. local Increment = 1.5 / S.stanceSettings.Speed
  2821. while true do
  2822. RS.RenderStepped:wait()
  2823. local newX = X + Increment
  2824. X = (newX > 90 and 90 or newX)
  2825. if Stance ~= 2 then break end
  2826. stanceSway = numLerp(prevStanceSway, 0.5, Sine(X))
  2827. if X == 90 then break end
  2828. end
  2829. end)
  2830. tweenJoint(ABWeld, CF(0, 0, -0.1), nil, Sine, S.stanceSettings.Speed)
  2831. tweenJoint(LLegWeld, legC0.Prone[1], nil, Sine, S.stanceSettings.Speed)
  2832. tweenJoint(RLegWeld, legC0.Prone[2], nil, Sine, S.stanceSettings.Speed)
  2833. tweenJoint(Root, CF(0, -2.5, 1) * CFANG(RAD(180), 0, RAD(180)), nil, Sine, S.stanceSettings.Speed)
  2834. tweenJoint(headWeld, CF(0, 1, 1) * CFANG(RAD(90), 0, 0), nil, Sine, S.stanceSettings.Speed)
  2835. else
  2836. ABWeld.C0 = CF(0, 0, -1 / 8)
  2837. LLegWeld.C0 = legC0.Prone[1]
  2838. RLegWeld.C0 = legC0.Prone[2]
  2839. Root.C0 = CF(0, -2.5, 1) * CFANG(RAD(180), 0, RAD(180))
  2840. headWeld.C0 = CF(0, 1, 1) * CFANG(RAD(90), 0, 0)
  2841. end
  2842. end
  2843.  
  2844. function Dive()
  2845. onGround = false
  2846. local diveDirection = (HRP.CFrame * CFANG(S.diveSettings.Angle, 0, 0)).lookVector * S.walkSpeeds.Sprinting * S.diveSettings.Force
  2847. local BF = Instance.new("BodyForce")
  2848. BF.force = diveDirection + Vector3.new(0, playerMass * 196.2, 0)
  2849. BF.Parent = HRP
  2850. --[[spawn(function()
  2851. HRP.Velocity = HRP.CFrame.lookVector * 60 + V3(0, 40, 0)
  2852. wait(0.1)
  2853. HRP.Velocity = HRP.CFrame.lookVector * 70 + V3(0, 30, 0)
  2854. wait(0.4)
  2855. HRP.Velocity = HRP.CFrame.lookVector * 30 + V3(0, -10, 0)
  2856. end)]]
  2857. delay(0.05, function()
  2858. spawn(function()
  2859. while true do
  2860. local newRay = Ray.new(HRP.Position, V3(0, -3.1, 0))
  2861. local H, _ = workspace:FindPartOnRayWithIgnoreList(newRay, Ignore)
  2862. if H then
  2863. onGround = true
  2864. break
  2865. end
  2866. wait()
  2867. end
  2868. end)
  2869. Prone()
  2870. wait(0.1)
  2871. BF:Destroy()
  2872. end)
  2873. end
  2874.  
  2875. --------------------[ MOUSE FUNCTIONS ]-----------------------------------------------
  2876.  
  2877. function onMB1Down()
  2878. MB1Down = true
  2879. firstShot = true
  2880. if fireFunction then
  2881. fireFunction()
  2882. end
  2883. end
  2884.  
  2885. function onMB1Up()
  2886. MB1Down = false
  2887. lowerSpread()
  2888. end
  2889.  
  2890. function onMB2Down()
  2891. if S.aimSettings.holdToADS then
  2892. if (not AimingIn) and (not Aimed) then
  2893. AimingIn = true
  2894. aimGun()
  2895. AimingIn = false
  2896. end
  2897. else
  2898. if Aimed then
  2899. unAimGun()
  2900. else
  2901. aimGun()
  2902. end
  2903. end
  2904. end
  2905.  
  2906. function onMB2Up()
  2907. if S.aimSettings.holdToADS then
  2908. if (not AimingOut) and Aimed then
  2909. AimingOut = true
  2910. unAimGun()
  2911. AimingOut = false
  2912. end
  2913. end
  2914. end
  2915.  
  2916. function onScrollUp()
  2917. local newAimSensitivity = aimSensitivity + S.sensitivitySettings.Increment
  2918. aimSensitivity = (
  2919. newAimSensitivity < S.sensitivitySettings.Min and S.sensitivitySettings.Min or
  2920. newAimSensitivity > S.sensitivitySettings.Max and S.sensitivitySettings.Max or
  2921. newAimSensitivity
  2922. )
  2923. mouseSensitivity = (Aimed and aimSensitivity or mouseSensitivity)
  2924.  
  2925. Sens.Text = "S: "..aimSensitivity
  2926. if mainGUI:IsDescendantOf(game) then
  2927. Sens.Visible = true
  2928. local t0 = tick()
  2929. lastSensUpdate = t0
  2930.  
  2931. wait(0.3)
  2932.  
  2933. if lastSensUpdate <= t0 then
  2934. Sens.Visible = false
  2935. end
  2936. end
  2937. end
  2938.  
  2939. function onScrollDown()
  2940. local newAimSensitivity = aimSensitivity - S.sensitivitySettings.Increment
  2941. aimSensitivity = (
  2942. newAimSensitivity < S.sensitivitySettings.Min and S.sensitivitySettings.Min or
  2943. newAimSensitivity > S.sensitivitySettings.Max and S.sensitivitySettings.Max or
  2944. newAimSensitivity
  2945. )
  2946. mouseSensitivity = (Aimed and aimSensitivity or mouseSensitivity)
  2947.  
  2948. Sens.Text = "S: "..aimSensitivity
  2949. if mainGUI:IsDescendantOf(game) then
  2950. Sens.Visible = true
  2951. local t0 = tick()
  2952. lastSensUpdate = t0
  2953.  
  2954. wait(0.3)
  2955.  
  2956. if lastSensUpdate <= t0 then
  2957. Sens.Visible = false
  2958. end
  2959. end
  2960. end
  2961.  
  2962. --------------------[ KEYBOARD FUNCTIONS ]--------------------------------------------
  2963.  
  2964. function keyDown(K)
  2965. local Key = string.lower(K)
  2966.  
  2967. if Key == S.Keys.lowerStance and S.canChangeStance then
  2968. if (not Running) then
  2969. if Stance == 0 then
  2970. if S.stanceSettings.Stances.Crouch then
  2971. Crouch()
  2972. elseif S.stanceSettings.Stances.Prone then
  2973. Prone()
  2974. end
  2975. elseif Stance == 1 then
  2976. if S.stanceSettings.Stances.Prone then
  2977. Prone()
  2978. end
  2979. end
  2980. elseif S.dolphinDive then
  2981. wait()
  2982. if Humanoid:GetState() ~= Enum.HumanoidStateType.Freefall and (not UIS:IsKeyDown("Space")) and runReady then
  2983. local tempConnection = Humanoid.Changed:connect(function()
  2984. Humanoid.Jump = false
  2985. end)
  2986. runReady = false
  2987. Dive()
  2988. Running = false
  2989. wait(S.diveSettings.rechargeTime)
  2990. tempConnection:disconnect()
  2991. runReady = true
  2992. end
  2993. end
  2994. end
  2995.  
  2996. if Key == S.Keys.raiseStance and S.canChangeStance then
  2997. if (not Running) then
  2998. if Stance == 2 then
  2999. if S.stanceSettings.Stances.Crouch then
  3000. Crouch()
  3001. else
  3002. Stand()
  3003. end
  3004. elseif Stance == 1 then
  3005. Stand()
  3006. end
  3007. end
  3008. end
  3009.  
  3010. if Key == S.Keys.ADS then
  3011. if S.aimSettings.holdToADS then
  3012. if (not AimingIn) and (not Aimed) then
  3013. AimingIn = true
  3014. aimGun()
  3015. AimingIn = false
  3016. end
  3017. else
  3018. if Aimed then
  3019. unAimGun()
  3020. else
  3021. aimGun()
  3022. end
  3023. end
  3024. end
  3025.  
  3026. if Key == S.Keys.selectFire and S.selectFire then
  3027. if canSelectFire then
  3028. canSelectFire = false
  3029. rawFireMode = rawFireMode + 1
  3030. modeGUI.Text = Modes[((rawFireMode - 1) % numModes) + 1]
  3031. if modeGUI.Text == "AUTO" then
  3032. fireFunction = autoFire
  3033. elseif modeGUI.Text == "BURST" then
  3034. fireFunction = burstFire
  3035. elseif modeGUI.Text == "SEMI" then
  3036. fireFunction = semiFire
  3037. else
  3038. fireFunction = nil
  3039. end
  3040. local speedAlpha = S.selectFireSettings.animSpeed / 0.6
  3041. if S.selectFireSettings.GUI then
  3042. spawn(function()
  3043. fireSelect.Visible = true
  3044. local prevRawFireMode = rawFireMode
  3045. local Increment = 1.5 / (speedAlpha * 0.25)
  3046. local X = 0
  3047. wait(speedAlpha * 0.1)
  3048. while true do
  3049. RS.RenderStepped:wait()
  3050. local newX = X + Increment
  3051. X = (newX > 90 and 90 or newX)
  3052. if prevRawFireMode ~= rawFireMode then break end
  3053. updateModeLabels(rawFireMode - 1, rawFireMode, X)
  3054. if X == 90 then break end
  3055. end
  3056. wait(speedAlpha * 0.25)
  3057. fireSelect.Visible = false
  3058. end)
  3059. end
  3060. if S.selectFireSettings.Animation and (not Aimed) and (not isRunning) and (not isCrawling) then
  3061. spawn(function()
  3062. local sequenceTable = {
  3063. function()
  3064. tweenJoint(RWeld2, nil, CFANG(0, RAD(5), 0), Sine, speedAlpha * 0.15)
  3065. tweenJoint(LWeld, armC0[1], CF(0.1, 1, -0.3) * CFANG(RAD(-7), 0, RAD(-65)), Linear, speedAlpha * 0.15)
  3066. wait(speedAlpha * 0.2)
  3067. end;
  3068.  
  3069. function()
  3070. tweenJoint(LWeld, armC0[1], CF(0.1, 1, -0.3) * CFANG(RAD(-10), 0, RAD(-65)), Linear, speedAlpha * 0.1)
  3071. wait(speedAlpha * 0.2)
  3072. end;
  3073.  
  3074. function()
  3075. tweenJoint(RWeld2, nil, CF(), Sine, speedAlpha * 0.2)
  3076. tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, speedAlpha * 0.2)
  3077. wait(speedAlpha * 0.2)
  3078. end;
  3079. }
  3080.  
  3081. for _, F in pairs(sequenceTable) do
  3082. if Aimed or isRunning or isCrawling or Reloading then
  3083. break
  3084. end
  3085. F()
  3086. end
  3087. end)
  3088. end
  3089. if S.selectFireSettings.Animation or S.selectFireSettings.GUI then
  3090. wait(S.selectFireSettings.animSpeed)
  3091. end
  3092. canSelectFire = true
  3093. end
  3094. end
  3095.  
  3096. if Key == S.Keys.Reload then
  3097. if (not Reloading) and (not isCrawling) then
  3098. Reload()
  3099. end
  3100. end
  3101.  
  3102. if Key == S.Keys.Sprint then
  3103. runKeyPressed = true
  3104. if runReady then
  3105. if (not Idling) and Walking and (not Running) and (not Knifing) and (not (Aimed and S.guiScope and S.Keys.Sprint == S.Keys.scopeSteady)) then
  3106. monitorStamina()
  3107. end
  3108. end
  3109. end
  3110.  
  3111. if Key == S.Keys.scopeSteady then
  3112. steadyKeyPressed = true
  3113. if Aimed and (not Aiming) then
  3114. takingBreath = false
  3115. steadyCamera()
  3116. end
  3117. end
  3118.  
  3119. for _, PTable in pairs(Plugins.KeyDown) do
  3120. if Key == string.lower(PTable.Key) then
  3121. spawn(function()
  3122. PTable.Plugin()
  3123. end)
  3124. end
  3125. end
  3126. end
  3127.  
  3128. function keyUp(K)
  3129. local Key = string.lower(K)
  3130.  
  3131. if Key == S.Keys.ADS then
  3132. if S.aimSettings.holdToADS then
  3133. if (not AimingOut) and Aimed then
  3134. AimingOut = true
  3135. unAimGun()
  3136. AimingOut = false
  3137. end
  3138. end
  3139. end
  3140.  
  3141. if Key == S.Keys.Sprint then
  3142. runKeyPressed = false
  3143. Running = false
  3144. if (not chargingStamina) then
  3145. rechargeStamina()
  3146. end
  3147. end
  3148.  
  3149. if Key == S.Keys.scopeSteady then
  3150. steadyKeyPressed = false
  3151. end
  3152.  
  3153. for _, PTable in pairs(Plugins.KeyUp) do
  3154. if Key == string.lower(PTable.Key) then
  3155. spawn(function()
  3156. PTable.Plugin()
  3157. end)
  3158. end
  3159. end
  3160. end
  3161.  
  3162. --------------------[ END FUNCTIONS ]-------------------------------------------------
  3163.  
  3164. --------------------------------------------------------------------------------------
  3165. --------------------[ PRE-CONNECTIONS ]-----------------------------------------------
  3166. --------------------------------------------------------------------------------------
  3167.  
  3168. local function updateAnimVars()
  3169. wait()
  3170. Forward = (UIS:IsKeyDown("W") or UIS:IsKeyDown("Up"))
  3171. Backward = (UIS:IsKeyDown("S") or UIS:IsKeyDown("Down"))
  3172. local Right = UIS:IsKeyDown("D")
  3173. local Left = UIS:IsKeyDown("A")
  3174.  
  3175. local walkingForward = (Forward and (not Backward))
  3176. local walkingBackward = ((not Forward) and Backward)
  3177. local walkingRight = (Right and (not Left))
  3178. local walkingLeft = ((not Right) and Left)
  3179.  
  3180. if (Forward or Backward or Right or Left) then
  3181. Walking, Idling = true, false
  3182. if (not Running) and (not Aimed) then
  3183. spreadMotion = "Moving"
  3184. baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
  3185. end
  3186. elseif (not (Forward and Backward and Right and Left)) then
  3187. Walking, Idling = false, true
  3188. if (not Aimed) then
  3189. spreadMotion = "Idling"
  3190. baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
  3191. end
  3192. end
  3193.  
  3194. local newArmTilt = (
  3195. ((walkingForward or walkingBackward) and walkingRight) and 2.5 or
  3196. ((walkingForward or walkingBackward) and walkingLeft) and -2.5 or
  3197. ((not (walkingForward and walkingBackward)) and walkingRight) and 5 or
  3198. ((not (walkingForward and walkingBackward)) and walkingLeft) and -5 or 0
  3199. )
  3200. local newMoveAng = (
  3201. (walkingForward and (not (walkingRight or walkingLeft))) and 0 or
  3202. (walkingForward and walkingRight) and RAD(-45) or
  3203. ((not (walkingForward or walkingBackward)) and walkingRight) and RAD(-90) or
  3204. (walkingBackward and walkingRight) and RAD(-135) or
  3205. (walkingBackward and (not (walkingRight or walkingLeft))) and (moveAng < 0 and RAD(-180) or RAD(180)) or
  3206. (walkingBackward and walkingLeft) and RAD(135) or
  3207. ((not (walkingForward or walkingBackward)) and walkingLeft) and RAD(90) or
  3208. (walkingForward and walkingLeft) and RAD(45) or 0
  3209. )
  3210.  
  3211. local newAnimCode = math.random(-1e9, 1e9)
  3212. animCode = newAnimCode
  3213. local startTilt = armTilt
  3214. local startAng = (ABS(moveAng) == RAD(180)) and (newMoveAng > 0 and RAD(180) or RAD(-180)) or moveAng
  3215. local Increment = (startTilt == newArmTilt and 1.5 / 0.7 or 1.5 / (0.35 * ABS(startTilt - newArmTilt) / 5))
  3216. local X = 0
  3217. while true do
  3218. RS.RenderStepped:wait()
  3219. local newX = X + Increment
  3220. X = (newX > 90 and 90 or newX)
  3221. if animCode ~= newAnimCode then break end
  3222. armTilt = numLerp(startTilt, newArmTilt, Sine(X))
  3223. moveAng = numLerp(startAng, newMoveAng, Sine(X))
  3224. if X == 90 then break end
  3225. end
  3226. end
  3227.  
  3228. M2.KeyDown:connect(updateAnimVars)
  3229. M2.KeyUp:connect(updateAnimVars)
  3230. updateAnimVars()
  3231.  
  3232. --------------------------------------------------------------------------------------
  3233. --------------------[ TOOL SELECTION AND DESELECTION ]--------------------------------
  3234. --------------------------------------------------------------------------------------
  3235.  
  3236. function onEquipped()
  3237. wait()
  3238. if Humanoid.Health ~= 0 and (not Selected) and Gun.Parent == Char then
  3239. Selected = true
  3240. breakReload = false
  3241. equipAnimPlaying = true
  3242.  
  3243. math.randomseed(tick()) --This sets a new seed for the random function each time you select the gun
  3244.  
  3245. --------------------[ FAILSAFE RESETING ]-------------------------------------
  3246.  
  3247. for _, GM in pairs(ignoreModel:GetChildren()) do
  3248. if GM.Name == "gunIgnore_"..Player.Name then
  3249. GM:Destroy()
  3250. end
  3251. end
  3252.  
  3253. for _, c in pairs(Connections) do
  3254. c:disconnect()
  3255. end
  3256.  
  3257. Connections = {}
  3258.  
  3259. --------------------[ REMOTE GUN SETUP ]--------------------------------------
  3260.  
  3261. --[[local Vars = {
  3262. ignoreModel = ignoreModel;
  3263. Humanoid = Humanoid;
  3264. Shoulders = Shoulders;
  3265. Torso = Torso;
  3266. Head = Head;
  3267. armC0 = armC0;
  3268. leftArmC1 = S.equipSettings.leftArmC1;
  3269. rightArmC1 = S.equipSettings.rightArmC1;
  3270. LArm = LArm;
  3271. RArm = RArm;
  3272. gunParts = gunParts;
  3273. Handle = Handle;
  3274. }
  3275. gunIgnore, playerFolder, headWeld, headWeld2, animWeld, ABWeld, LWeld, RWeld, LWeld2, RWeld2, LLegWeld, RLegWeld, gunParts2 = gunSetup:InvokeServer(Vars)]]
  3276.  
  3277. --------------------[ CREATING IGNORE MODELS ]--------------------------------
  3278.  
  3279. gunIgnore = Instance.new("Model")
  3280. gunIgnore.Name = "gunIgnore_"..Player.Name
  3281. gunIgnore.Parent = ignoreModel
  3282.  
  3283. --------------------[ MODIFYING THE PLAYER ]----------------------------------
  3284.  
  3285. Player.CameraMode = Enum.CameraMode.LockFirstPerson
  3286. Cam.CameraType = Enum.CameraType.Scriptable
  3287. Cam.FieldOfView = 80
  3288. UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
  3289. UIS.MouseIconEnabled = false
  3290.  
  3291. local initialX, initialY = getYawPitch(Cam.CoordinateFrame)
  3292. camAng = -VEC2(initialX, initialY)
  3293.  
  3294. mainGUI.Parent = Player.PlayerGui
  3295.  
  3296. setUpGUI()
  3297. updateHealth()
  3298.  
  3299. if S.selectFire then
  3300. local currentMode = Modes[((rawFireMode - 1) % numModes) + 1]
  3301. if currentMode == "AUTO" then
  3302. fireFunction = autoFire
  3303. elseif currentMode == "BURST" then
  3304. fireFunction = burstFire
  3305. elseif currentMode == "SEMI" then
  3306. fireFunction = semiFire
  3307. else
  3308. fireFunction = nil
  3309. end
  3310. else
  3311. if S.gunType.Semi then
  3312. fireFunction = semiFire
  3313. elseif S.gunType.Auto then
  3314. fireFunction = autoFire
  3315. elseif S.gunType.Burst then
  3316. fireFunction = burstFire
  3317. else
  3318. fireFunction = nil
  3319. end
  3320. end
  3321.  
  3322. changePlayerTrans(Char, 1)
  3323.  
  3324. Humanoid.AutoRotate = false
  3325.  
  3326. Shoulders.Right.Part1 = nil
  3327. Shoulders.Left.Part1 = nil
  3328.  
  3329. playerFolder = Instance.new("Model")
  3330. playerFolder.Name = "playerFolder"
  3331. playerFolder.Parent = gunIgnore
  3332.  
  3333. local headBase = Instance.new("Part")
  3334. headBase.Transparency = 1
  3335. headBase.Name = "headBase"
  3336. headBase.CanCollide = false
  3337. headBase.FormFactor = Enum.FormFactor.Custom
  3338. headBase.Size = V3(0.2, 0.2, 0.2)
  3339. headBase.BottomSurface = Enum.SurfaceType.Smooth
  3340. headBase.TopSurface = Enum.SurfaceType.Smooth
  3341. headBase.Parent = playerFolder
  3342.  
  3343. headWeld = Instance.new("Weld")
  3344. headWeld.Part0 = Torso
  3345. headWeld.Part1 = headBase
  3346. headWeld.C0 = CF(0, 1.5, 0)
  3347. headWeld.Parent = Torso
  3348.  
  3349. headWeld2 = Instance.new("Weld")
  3350. headWeld2.Part0 = headBase
  3351. headWeld2.Part1 = Head
  3352. headWeld2.Parent = headBase
  3353.  
  3354. neckClone = Neck:Clone()
  3355.  
  3356. --[[local stanceBase = Instance.new("Part")
  3357. stanceBase.Transparency = 1
  3358. stanceBase.Name = "stanceBase"
  3359. stanceBase.CanCollide = false
  3360. stanceBase.FormFactor = Enum.FormFactor.Custom
  3361. stanceBase.Size = V3(0.2, 0.2, 0.2)
  3362. stanceBase.BottomSurface = Enum.SurfaceType.Smooth
  3363. stanceBase.TopSurface = Enum.SurfaceType.Smooth
  3364. stanceBase.Parent = playerFolder
  3365.  
  3366. stanceWeld = Instance.new("Weld")
  3367. stanceWeld.Part0 = stanceBase
  3368. stanceWeld.Part1 = Torso
  3369. stanceWeld.Parent = stanceBase]]
  3370.  
  3371. local animBase = Instance.new("Part")
  3372. animBase.Transparency = 1
  3373. animBase.Name = "animBase"
  3374. animBase.CanCollide = false
  3375. animBase.FormFactor = Enum.FormFactor.Custom
  3376. animBase.Size = V3(0.2, 0.2, 0.2)
  3377. animBase.BottomSurface = Enum.SurfaceType.Smooth
  3378. animBase.TopSurface = Enum.SurfaceType.Smooth
  3379. animBase.Parent = playerFolder
  3380.  
  3381. animWeld = Instance.new("Weld")
  3382. animWeld.Part0 = animBase
  3383. animWeld.Part1 = headBase
  3384. animWeld.Parent = animBase
  3385.  
  3386. local ArmBase = Instance.new("Part")
  3387. ArmBase.Transparency = 1
  3388. ArmBase.Name = "ArmBase"
  3389. ArmBase.CanCollide = false
  3390. ArmBase.FormFactor = Enum.FormFactor.Custom
  3391. ArmBase.Size = V3(0.2, 0.2, 0.2)
  3392. ArmBase.BottomSurface = Enum.SurfaceType.Smooth
  3393. ArmBase.TopSurface = Enum.SurfaceType.Smooth
  3394. ArmBase.Parent = playerFolder
  3395.  
  3396. ABWeld = Instance.new("Weld")
  3397. ABWeld.Part0 = ArmBase
  3398. ABWeld.Part1 = animBase
  3399. ABWeld.Parent = ArmBase
  3400.  
  3401. local LArmBase = Instance.new("Part")
  3402. LArmBase.Transparency = 1
  3403. LArmBase.Name = "LArmBase"
  3404. LArmBase.CanCollide = false
  3405. LArmBase.FormFactor = Enum.FormFactor.Custom
  3406. LArmBase.Size = V3(0.2, 0.2, 0.2)
  3407. LArmBase.BottomSurface = Enum.SurfaceType.Smooth
  3408. LArmBase.TopSurface = Enum.SurfaceType.Smooth
  3409. LArmBase.Parent = playerFolder
  3410.  
  3411. local RArmBase = Instance.new("Part")
  3412. RArmBase.Transparency = 1
  3413. RArmBase.Name = "RArmBase"
  3414. RArmBase.CanCollide = false
  3415. RArmBase.FormFactor = Enum.FormFactor.Custom
  3416. RArmBase.Size = V3(0.2, 0.2, 0.2)
  3417. RArmBase.BottomSurface = Enum.SurfaceType.Smooth
  3418. RArmBase.TopSurface = Enum.SurfaceType.Smooth
  3419. RArmBase.Parent = playerFolder
  3420.  
  3421. LWeld = Instance.new("Weld")
  3422. LWeld.Name = "LWeld"
  3423. LWeld.Part0 = ArmBase
  3424. LWeld.Part1 = LArmBase
  3425. LWeld.C0 = armC0[1]
  3426. LWeld.C1 = S.equipSettings.leftArmC1
  3427. LWeld.Parent = ArmBase
  3428.  
  3429. RWeld = Instance.new("Weld")
  3430. RWeld.Name = "RWeld"
  3431. RWeld.Part0 = ArmBase
  3432. RWeld.Part1 = RArmBase
  3433. RWeld.C0 = armC0[2]
  3434. RWeld.C1 = S.equipSettings.rightArmC1
  3435. RWeld.Parent = ArmBase
  3436.  
  3437. LWeld2 = Instance.new("Weld")
  3438. LWeld2.Name = "LWeld"
  3439. LWeld2.Part0 = LArmBase
  3440. LWeld2.Part1 = LArm
  3441. LWeld2.Parent = LArmBase
  3442.  
  3443. RWeld2 = Instance.new("Weld")
  3444. RWeld2.Name = "RWeld"
  3445. RWeld2.Part0 = RArmBase
  3446. RWeld2.Part1 = RArm
  3447. RWeld2.Parent = RArmBase
  3448.  
  3449. LLegWeld = Instance.new("Weld")
  3450. LLegWeld.Name = "LLegWeld"
  3451. LLegWeld.Part0 = Torso
  3452. LLegWeld.Part1 = nil
  3453. LLegWeld.C0 = CF(-0.5, -2, 0)
  3454. LLegWeld.Parent = Torso
  3455.  
  3456. RLegWeld = Instance.new("Weld")
  3457. RLegWeld.Name = "RLegWeld"
  3458. RLegWeld.Part0 = Torso
  3459. RLegWeld.Part1 = nil
  3460. RLegWeld.C0 = CF(0.5, -2, 0)
  3461. RLegWeld.Parent = Torso
  3462.  
  3463. if S.playerArms then
  3464. armModel = Instance.new("Model", workspace.FilteringEnabled and playerFolder or Cam)
  3465.  
  3466. fakeLArm = LArm:Clone()
  3467. fakeLArm.Parent = armModel
  3468. fakeLArm.Transparency = S.fakeArmSettings.Transparency
  3469. fakeLArm.CanCollide = false
  3470. fakeLArm.Size = S.fakeArmSettings.armSize
  3471. fakeLArm:BreakJoints()
  3472.  
  3473. --LArm.Transparency = 1
  3474.  
  3475. local fakeLWeld = Instance.new("Weld")
  3476. fakeLWeld.Part0 = fakeLArm
  3477. fakeLWeld.Part1 = LArm
  3478. fakeLWeld.Parent = fakeLArm
  3479.  
  3480. fakeRArm = RArm:Clone()
  3481. fakeRArm.Parent = armModel
  3482. fakeRArm.Transparency = S.fakeArmSettings.Transparency
  3483. fakeRArm.CanCollide = false
  3484. fakeRArm.Size = S.fakeArmSettings.armSize
  3485. fakeRArm:BreakJoints()
  3486.  
  3487. --RArm.Transparency = 1
  3488.  
  3489. local fakeRWeld = Instance.new("Weld")
  3490. fakeRWeld.Part0 = fakeRArm
  3491. fakeRWeld.Part1 = RArm
  3492. fakeRWeld.Parent = fakeRArm
  3493.  
  3494. Instance.new("Humanoid", armModel)
  3495.  
  3496. if S.fakeArmSettings.characterMeshes then
  3497. for _,Obj in pairs(Char:GetChildren()) do
  3498. if Obj:IsA("CharacterMesh") then
  3499. Obj:Clone().Parent = armModel
  3500. end
  3501. end
  3502. end
  3503. for _,Obj in pairs(Char:GetChildren()) do
  3504. if Obj:IsA("Shirt") then
  3505. Obj:Clone().Parent = armModel
  3506. end
  3507. end
  3508. else
  3509. armTable = createArms()
  3510. if workspace.FilteringEnabled then
  3511. armTable[1].Model.Parent = playerFolder
  3512. armTable[2].Model.Parent = playerFolder
  3513. else
  3514. armTable[1].Model.Parent = Cam--playerFolder
  3515. armTable[2].Model.Parent = Cam--playerFolder
  3516. end
  3517.  
  3518. fakeLArm = armTable[1].armPart
  3519.  
  3520. --LArm.Transparency = 1
  3521.  
  3522. local fakeLWeld = Instance.new("Weld")
  3523. fakeLWeld.Part0 = fakeLArm
  3524. fakeLWeld.Part1 = LArm
  3525. fakeLWeld.Parent = fakeLArm
  3526.  
  3527. fakeRArm = armTable[2].armPart
  3528.  
  3529. --RArm.Transparency = 1
  3530.  
  3531. local fakeRWeld = Instance.new("Weld")
  3532. fakeRWeld.Part0 = fakeRArm
  3533. fakeRWeld.Part1 = RArm
  3534. fakeRWeld.Parent = fakeRArm
  3535. end
  3536.  
  3537. --------------------[ MODIFYING THE GUN ]-------------------------------------
  3538.  
  3539. for _, Tab in pairs(gunParts) do
  3540. local Weld = Instance.new("Weld")
  3541. Weld.Name = "MainWeld"
  3542. Weld.Part0 = Handle
  3543. Weld.Part1 = Tab.Obj
  3544. Weld.C0 = Tab.Obj.weldCF.Value
  3545. Weld.Parent = Handle
  3546. Tab.Weld = Weld
  3547. end
  3548.  
  3549. Grip = RArm:WaitForChild("RightGrip")
  3550.  
  3551. local handleCF = Torso.CFrame * CF(0, 0.5, 0) * armC0[2] * S.aimedC1.rightArm:inverse() * Grip.C0
  3552. local handleOffset = AimPart.CFrame:toObjectSpace(Handle.CFrame)
  3553. aimedGripCF = ((Torso.CFrame * CF(headOffset.X, headOffset.Y, 0)) * handleOffset):toObjectSpace(handleCF)
  3554.  
  3555. Grip.C1 = S.equipSettings.GripC1
  3556.  
  3557. --------------------[ RUNNING PLUGINS ]---------------------------------------
  3558.  
  3559. for _, Plugin in pairs(Plugins.OnEquipped) do
  3560. spawn(function()
  3561. Plugin()
  3562. end)
  3563. end
  3564.  
  3565. --------------------[ GETTING PLAYER MASS ]-----------------------------------
  3566.  
  3567. local connectedParts = HRP:GetConnectedParts(true)
  3568. for _, v in pairs(connectedParts) do
  3569. if v:IsA("BasePart") then
  3570. playerMass = playerMass + v:GetMass()
  3571. end
  3572. end
  3573.  
  3574. --------------------[ CONNECTIONS ]-------------------------------------------
  3575.  
  3576. INSERT(Connections, Humanoid.Died:connect(function()
  3577. onUnequipped(true)
  3578. end))
  3579.  
  3580. INSERT(Connections, Humanoid.Jumping:connect(function()
  3581. if Stance ~= 0 then
  3582. Stand()
  3583. end
  3584. end))
  3585.  
  3586. INSERT(Connections, Humanoid.StateChanged:connect(onHumanoidStateChanged))
  3587.  
  3588. INSERT(Connections, Humanoid.HealthChanged:connect(updateHealth))
  3589.  
  3590. INSERT(Connections, M2.Button1Down:connect(onMB1Down))
  3591.  
  3592. INSERT(Connections, M2.Button1Up:connect(onMB1Up))
  3593.  
  3594. INSERT(Connections, M2.Button2Down:connect(onMB2Down))
  3595.  
  3596. INSERT(Connections, M2.Button2Up:connect(onMB2Up))
  3597.  
  3598. INSERT(Connections, M2.KeyDown:connect(keyDown))
  3599.  
  3600. INSERT(Connections, M2.KeyUp:connect(keyUp))
  3601.  
  3602. if S.sensitivitySettings.scrollToChange then
  3603. INSERT(Connections, M2.WheelForward:connect(onScrollUp))
  3604. INSERT(Connections, M2.WheelBackward:connect(onScrollDown))
  3605. end
  3606.  
  3607. if S.AutoKnife then
  3608. INSERT(Connections, RS.Stepped:connect(function()
  3609. local H, P = AdvRayCast(Head.CFrame.p, Head.CFrame.lookVector, S.AutoKnifeDist, nil)
  3610. if H then
  3611. local HitHuman = findFirstClass(H.Parent, "Humanoid")
  3612. if HitHuman and isEnemy(HitHuman) and HitHuman.Health ~= 0 then
  3613. Knife()
  3614. end
  3615. end
  3616. end))
  3617. end
  3618.  
  3619. INSERT(Connections, UIS.InputChanged:connect(function(inputObj)
  3620. if inputObj.UserInputType == Enum.UserInputType.MouseMovement then
  3621. local rawCamAng = camAng - (VEC2(RAD(inputObj.Delta.x), RAD(inputObj.Delta.y)) * mouseSensitivity * 0.25)
  3622. camAng = VEC2(rawCamAng.x, (rawCamAng.y > RAD(80) and RAD(80) or rawCamAng.y < RAD(-80) and RAD(-80) or rawCamAng.y))
  3623.  
  3624. desiredXOffset = math.min(math.max(inputObj.Delta.x, -S.momentumSettings.maxInput), S.momentumSettings.maxInput)
  3625. desiredYOffset = math.min(math.max(inputObj.Delta.y, -S.momentumSettings.maxInput), S.momentumSettings.maxInput)
  3626. end
  3627. end))
  3628.  
  3629. INSERT(Connections, M2.Idle:connect(function(inputObj)
  3630. desiredXOffset = 0
  3631. desiredYOffset = 0
  3632. end))
  3633.  
  3634. INSERT(Connections, RS.Stepped:connect(function()
  3635. if tick() - lastBeat > (Humanoid.Health / 75) then
  3636. lastBeat = tick()
  3637. HUD.Health.Tray.Beat:TweenPosition(
  3638. UDim2.new(0, -21, 0, 0),
  3639. Enum.EasingDirection.Out,
  3640. Enum.EasingStyle.Linear,
  3641. 0.7 - ((100 - Humanoid.Health) / 400),
  3642. false,
  3643. function()
  3644. HUD.Health.Tray.Beat.Position = UDim2.new(1, 0, 0, 0)
  3645. end
  3646. )
  3647. end
  3648. end))
  3649.  
  3650. INSERT(Connections, RS.RenderStepped:connect(function()
  3651. --Main animation
  3652. local animC0, animC1 = getAnimCF()
  3653. animWeld.C0 = animC0
  3654. animWeld.C1 = animC1
  3655.  
  3656. --Camera updating
  3657. renderCamera()
  3658. end))
  3659.  
  3660. --------------------[ ANIMATE GUN ]-------------------------------------------
  3661.  
  3662. tweenJoint(LWeld, nil, S.unAimedC1.leftArm, Sine, S.equipSettings.Time)
  3663. tweenJoint(RWeld, nil, S.unAimedC1.rightArm, Sine, S.equipSettings.Time)
  3664. tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, S.equipSettings.Time)
  3665. spawn(function()
  3666. local T = tick()
  3667. while true do
  3668. if tick() - T > S.equipSettings.Time then break end
  3669. if (not Selected) then break end
  3670. wait()
  3671. end
  3672. equipAnimPlaying = false
  3673. end)
  3674.  
  3675. Animate()
  3676. end
  3677. end
  3678.  
  3679. function onUnequipped(deleteTool)
  3680. if Selected then
  3681. Selected = false
  3682.  
  3683. breakReload = true
  3684.  
  3685. --------------------[ RUNNING PLUGINS ]---------------------------------------
  3686.  
  3687. for _, Plugin in pairs(Plugins.OnUnEquipped) do
  3688. spawn(function()
  3689. Plugin()
  3690. end)
  3691. end
  3692.  
  3693. --------------------[ MODIFYING THE PLAYER ]----------------------------------
  3694.  
  3695. Cam.FieldOfView = 70
  3696. Cam.CameraType = Enum.CameraType.Custom
  3697.  
  3698. UIS.MouseBehavior = Enum.MouseBehavior.Default
  3699. UIS.MouseIconEnabled = true
  3700.  
  3701. Player.CameraMode = Enum.CameraMode.Classic
  3702.  
  3703. if armTable then
  3704. armTable[1].Model:Destroy()
  3705. armTable[2].Model:Destroy()
  3706. elseif armModel then
  3707. armModel:Destroy()
  3708. end
  3709.  
  3710. LLegWeld:Destroy()
  3711. RLegWeld:Destroy()
  3712.  
  3713. changePlayerTrans(Char, 0)
  3714.  
  3715. mainGUI.Parent = script
  3716.  
  3717. Shoulders.Right.Part1 = RArm
  3718. Shoulders.Left.Part1 = LArm
  3719.  
  3720. neckClone.Parent = Torso
  3721. headWeld:Destroy()
  3722.  
  3723. Humanoid.WalkSpeed = 16
  3724. Humanoid.AutoRotate = true
  3725.  
  3726. --------------------[ RESETING THE TOOL ]-------------------------------------
  3727.  
  3728. gunIgnore:Destroy()
  3729.  
  3730. mouseSensitivity = S.sensitivitySettings.Default
  3731.  
  3732. MB1Down = false
  3733.  
  3734. playerMass = 0
  3735.  
  3736. Aimed = false
  3737.  
  3738. camOffsets = {
  3739. guiScope = {
  3740. Rot = V3();
  3741. };
  3742. Reload = {
  3743. Rot = V3();
  3744. Code = nil;
  3745. };
  3746. Recoil = {
  3747. Rot = V3();
  3748. Code = nil;
  3749. };
  3750. }
  3751.  
  3752. recoilAnim = {
  3753. Pos = V3();
  3754. Rot = V3();
  3755. Code = nil;
  3756. }
  3757.  
  3758. --Setting the aim variables to unaimed
  3759. spreadZoom = "unAimed"
  3760. scopeMain.Visible = false
  3761. scopeSteady.Visible = false
  3762. aimAlpha = 0
  3763. aimHeadOffset = 0
  3764. jumpAnimMultiplier = 1
  3765. translationDivisor = 7
  3766. rotationMultiplier = S.momentumSettings.Amplitude.unAimed
  3767. armTiltMultiplier = 1
  3768. Scope.BackgroundTransparency = 1
  3769. if S.guiScope then
  3770. spawn(function()
  3771. for _, Obj in pairs(Gun:GetChildren()) do
  3772. if Obj:IsA("BasePart") then
  3773. Obj.LocalTransparencyModifier = 0
  3774. end
  3775. end
  3776. end)
  3777. end
  3778.  
  3779. onGround = true
  3780.  
  3781. for _, Tab in pairs(gunParts) do
  3782. Tab.Weld:Destroy()
  3783. Tab.Weld = nil
  3784. end
  3785.  
  3786. for _,c in pairs(Connections) do
  3787. c:disconnect()
  3788. end
  3789.  
  3790. Connections = {}
  3791.  
  3792. if deleteTool then
  3793. Cam:ClearAllChildren()
  3794. Gun:Destroy()
  3795. end
  3796.  
  3797. wait() --This is here in case you dolphin dived and deselected the tool instantly
  3798.  
  3799. if S.stanceSettings.standOnDeselect and Stance ~= 0 then
  3800. crawlCamRot = 0
  3801. isCrawling = false
  3802. stanceSway = 1
  3803. spreadStance = "Stand"
  3804. Stand(true)
  3805. end
  3806. baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
  3807. end
  3808. end
  3809.  
  3810. Gun.Equipped:connect(onEquipped)
  3811. Gun.Unequipped:connect(function() onUnequipped(false) end)
  3812.  
  3813. --------------------------------------------------------------------------------------
  3814. --------------------[ END PROGRAM ]---------------------------------------------------
  3815. --------------------------------------------------------------------------------------
  3816. end,o10)
  3817. end))
  3818. o11.Name = "ignoreCode"
  3819. o11.Parent = o10
  3820. o12.Name = "Server_Scripts"
  3821. o12.Parent = o10
  3822. o15.Name = "mainGUI"
  3823. o15.Parent = o10
  3824. o16.Name = "hitMarker"
  3825. o16.Parent = o15
  3826. o16.Position = UDim2.new(0.5,-13,0.5,-31)
  3827. o16.Size = UDim2.new(0,26,0,26)
  3828. o16.Position = UDim2.new(0.5,-13,0.5,-31)
  3829. o16.Visible = false
  3830. o16.BackgroundTransparency = 1
  3831. o16.ZIndex = 10
  3832. o16.Image = "http://www.roblox.com/asset/?id=121173757"
  3833. o17.Name = "lastMark"
  3834. o17.Parent = o16
  3835. o18.Name = "crossHair"
  3836. o18.Parent = o15
  3837. o18.Position = UDim2.new(0.5,0,0.5,-18)
  3838. o18.Position = UDim2.new(0.5,0,0.5,-18)
  3839. o18.BackgroundColor3 = Color3.new(1, 1, 1)
  3840. o18.BorderColor3 = Color3.new(0, 0, 0)
  3841. o18.BorderSizePixel = 0
  3842. o19.Parent = o18
  3843. o19.Position = UDim2.new(0,-150,0,-150)
  3844. o19.Size = UDim2.new(0,300,0,300)
  3845. o19.Position = UDim2.new(0,-150,0,-150)
  3846. o19.Visible = false
  3847. o19.BackgroundColor3 = Color3.new(1, 1, 1)
  3848. o19.BackgroundTransparency = 1
  3849. o19.ZIndex = 2
  3850. o19.Image = "http://www.roblox.com/asset/?id=68308747"
  3851. o20.Name = "Reload"
  3852. o20.Parent = o18
  3853. o20.Position = UDim2.new(0,-50,0,70)
  3854. o20.Size = UDim2.new(0,100,0,20)
  3855. o20.Text = "Reloading..."
  3856. o20.Position = UDim2.new(0,-50,0,70)
  3857. o20.Visible = false
  3858. o20.BackgroundColor3 = Color3.new(1, 1, 1)
  3859. o20.BackgroundTransparency = 1
  3860. o20.ZIndex = 2
  3861. o20.Font = Enum.Font.SourceSansBold
  3862. o20.FontSize = Enum.FontSize.Size18
  3863. o20.TextColor3 = Color3.new(1, 1, 1)
  3864. o20.TextStrokeTransparency = 0.5
  3865. o21.Name = "C"
  3866. o21.Parent = o18
  3867. o21.Position = UDim2.new(0,-2,0,0)
  3868. o21.Size = UDim2.new(0,4,0,500)
  3869. o21.Position = UDim2.new(0,-2,0,0)
  3870. o21.BackgroundColor3 = Color3.new(1, 1, 1)
  3871. o21.BackgroundTransparency = 1
  3872. o21.ClipsDescendants = true
  3873. o22.Name = "Line"
  3874. o22.Parent = o21
  3875. o22.Position = UDim2.new(0.5,-1,0,10)
  3876. o22.Size = UDim2.new(0,2,0,15)
  3877. o22.Text = ""
  3878. o22.Position = UDim2.new(0.5,-1,0,10)
  3879. o22.BackgroundColor3 = Color3.new(1, 1, 1)
  3880. o22.BorderColor3 = Color3.new(0.392157, 0.392157, 0.392157)
  3881. o22.Font = Enum.Font.SourceSans
  3882. o22.FontSize = Enum.FontSize.Size14
  3883. o23.Name = "A"
  3884. o23.Parent = o18
  3885. o23.Position = UDim2.new(0,-2,0,-500)
  3886. o23.Size = UDim2.new(0,4,0,500)
  3887. o23.Position = UDim2.new(0,-2,0,-500)
  3888. o23.BackgroundColor3 = Color3.new(1, 1, 1)
  3889. o23.BackgroundTransparency = 1
  3890. o23.ClipsDescendants = true
  3891. o24.Name = "Line"
  3892. o24.Parent = o23
  3893. o24.Position = UDim2.new(0.5,-1,1,-25)
  3894. o24.Size = UDim2.new(0,2,0,15)
  3895. o24.Text = ""
  3896. o24.Position = UDim2.new(0.5,-1,1,-25)
  3897. o24.BackgroundColor3 = Color3.new(1, 1, 1)
  3898. o24.BorderColor3 = Color3.new(0.392157, 0.392157, 0.392157)
  3899. o24.Font = Enum.Font.SourceSans
  3900. o24.FontSize = Enum.FontSize.Size14
  3901. o25.Name = "B"
  3902. o25.Parent = o18
  3903. o25.Position = UDim2.new(0,0,0,-2)
  3904. o25.Size = UDim2.new(0,500,0,4)
  3905. o25.Position = UDim2.new(0,0,0,-2)
  3906. o25.BackgroundColor3 = Color3.new(1, 1, 1)
  3907. o25.BackgroundTransparency = 1
  3908. o25.ClipsDescendants = true
  3909. o26.Name = "Line"
  3910. o26.Parent = o25
  3911. o26.Position = UDim2.new(0,10,0.5,-1)
  3912. o26.Size = UDim2.new(0,15,0,2)
  3913. o26.Text = ""
  3914. o26.Position = UDim2.new(0,10,0.5,-1)
  3915. o26.BackgroundColor3 = Color3.new(1, 1, 1)
  3916. o26.BorderColor3 = Color3.new(0.392157, 0.392157, 0.392157)
  3917. o26.Font = Enum.Font.SourceSans
  3918. o26.FontSize = Enum.FontSize.Size14
  3919. o27.Name = "D"
  3920. o27.Parent = o18
  3921. o27.Position = UDim2.new(0,-500,0,-2)
  3922. o27.Size = UDim2.new(0,500,0,4)
  3923. o27.Position = UDim2.new(0,-500,0,-2)
  3924. o27.BackgroundColor3 = Color3.new(1, 1, 1)
  3925. o27.BackgroundTransparency = 1
  3926. o27.ClipsDescendants = true
  3927. o28.Name = "Line"
  3928. o28.Parent = o27
  3929. o28.Position = UDim2.new(1,-25,0.5,-1)
  3930. o28.Size = UDim2.new(0,15,0,2)
  3931. o28.Text = ""
  3932. o28.Position = UDim2.new(1,-25,0.5,-1)
  3933. o28.BackgroundColor3 = Color3.new(1, 1, 1)
  3934. o28.BorderColor3 = Color3.new(0.392157, 0.392157, 0.392157)
  3935. o28.Font = Enum.Font.SourceSans
  3936. o28.FontSize = Enum.FontSize.Size14
  3937. o29.Name = "HUD"
  3938. o29.Parent = o15
  3939. o29.Position = UDim2.new(1,-200,1,-165)
  3940. o29.Size = UDim2.new(0,175,0,90)
  3941. o29.Position = UDim2.new(1,-200,1,-165)
  3942. o29.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
  3943. o29.BackgroundTransparency = 0.30000001192093
  3944. o29.BorderColor3 = Color3.new(0.156863, 0.156863, 0.156863)
  3945. o29.BorderSizePixel = 5
  3946. o29.ZIndex = 10
  3947. o30.Name = "Ammo"
  3948. o30.Parent = o29
  3949. o30.Position = UDim2.new(0,0,0,45)
  3950. o30.Size = UDim2.new(0,175,0,40)
  3951. o30.Position = UDim2.new(0,0,0,45)
  3952. o30.BackgroundTransparency = 1
  3953. o30.ZIndex = 10
  3954. o31.Name = "Slash"
  3955. o31.Parent = o30
  3956. o31.Position = UDim2.new(0,90,0,0)
  3957. o31.Size = UDim2.new(0,10,0,25)
  3958. o31.Text = "/"
  3959. o31.Position = UDim2.new(0,90,0,0)
  3960. o31.BackgroundTransparency = 1
  3961. o31.ZIndex = 10
  3962. o31.Font = Enum.Font.ArialBold
  3963. o31.FontSize = Enum.FontSize.Size24
  3964. o31.TextColor3 = Color3.new(1, 1, 1)
  3965. o32.Name = "Stored"
  3966. o32.Parent = o30
  3967. o32.Position = UDim2.new(0,105,0,0)
  3968. o32.Size = UDim2.new(0,70,0,25)
  3969. o32.Text = "100"
  3970. o32.Position = UDim2.new(0,105,0,0)
  3971. o32.BackgroundTransparency = 1
  3972. o32.ZIndex = 10
  3973. o32.Font = Enum.Font.ArialBold
  3974. o32.FontSize = Enum.FontSize.Size24
  3975. o32.TextColor3 = Color3.new(1, 1, 1)
  3976. o32.TextXAlignment = Enum.TextXAlignment.Left
  3977. o33.Name = "Background"
  3978. o33.Parent = o32
  3979. o33.Size = UDim2.new(1,0,1,0)
  3980. o33.Text = "000"
  3981. o33.BackgroundTransparency = 1
  3982. o33.ZIndex = 10
  3983. o33.Font = Enum.Font.ArialBold
  3984. o33.FontSize = Enum.FontSize.Size24
  3985. o33.TextColor3 = Color3.new(0.588235, 0.588235, 0.588235)
  3986. o33.TextTransparency = 0.80000001192093
  3987. o33.TextWrapped = true
  3988. o33.TextXAlignment = Enum.TextXAlignment.Left
  3989. o34.Name = "Clip"
  3990. o34.Parent = o30
  3991. o34.Size = UDim2.new(0,85,1,0)
  3992. o34.Text = "9"
  3993. o34.BackgroundTransparency = 1
  3994. o34.ZIndex = 10
  3995. o34.Font = Enum.Font.ArialBold
  3996. o34.FontSize = Enum.FontSize.Size48
  3997. o34.TextColor3 = Color3.new(1, 1, 1)
  3998. o34.TextXAlignment = Enum.TextXAlignment.Right
  3999. o35.Name = "Background"
  4000. o35.Parent = o34
  4001. o35.Size = UDim2.new(1,0,1,0)
  4002. o35.Text = "000"
  4003. o35.BackgroundTransparency = 1
  4004. o35.ZIndex = 10
  4005. o35.Font = Enum.Font.ArialBold
  4006. o35.FontSize = Enum.FontSize.Size48
  4007. o35.TextColor3 = Color3.new(0.588235, 0.588235, 0.588235)
  4008. o35.TextTransparency = 0.80000001192093
  4009. o35.TextXAlignment = Enum.TextXAlignment.Right
  4010. o36.Name = "Mode"
  4011. o36.Parent = o29
  4012. o36.Position = UDim2.new(0,90,0,65)
  4013. o36.Size = UDim2.new(0,85,0,20)
  4014. o36.Position = UDim2.new(0,90,0,65)
  4015. o36.BackgroundColor3 = Color3.new(1, 1, 1)
  4016. o36.BackgroundTransparency = 1
  4017. o36.ZIndex = 10
  4018. o37.Name = "Bracket"
  4019. o37.Parent = o36
  4020. o37.Size = UDim2.new(0,5,0,20)
  4021. o37.Text = "["
  4022. o37.BackgroundTransparency = 1
  4023. o37.ZIndex = 10
  4024. o37.Font = Enum.Font.ArialBold
  4025. o37.FontSize = Enum.FontSize.Size18
  4026. o37.TextColor3 = Color3.new(1, 1, 1)
  4027. o37.TextXAlignment = Enum.TextXAlignment.Left
  4028. o38.Name = "Bracket"
  4029. o38.Parent = o36
  4030. o38.Position = UDim2.new(1,-5,0,0)
  4031. o38.Size = UDim2.new(0,5,0,20)
  4032. o38.Text = "]"
  4033. o38.Position = UDim2.new(1,-5,0,0)
  4034. o38.BackgroundTransparency = 1
  4035. o38.ZIndex = 10
  4036. o38.Font = Enum.Font.ArialBold
  4037. o38.FontSize = Enum.FontSize.Size18
  4038. o38.TextColor3 = Color3.new(1, 1, 1)
  4039. o38.TextXAlignment = Enum.TextXAlignment.Left
  4040. o39.Name = "Main"
  4041. o39.Parent = o36
  4042. o39.Size = UDim2.new(1,0,0,20)
  4043. o39.Text = "Auto"
  4044. o39.BackgroundTransparency = 1
  4045. o39.ZIndex = 10
  4046. o39.Font = Enum.Font.SourceSansBold
  4047. o39.FontSize = Enum.FontSize.Size18
  4048. o39.TextColor3 = Color3.new(1, 1, 1)
  4049. o39.TextWrapped = true
  4050. o40.Name = "Health"
  4051. o40.Parent = o29
  4052. o40.Position = UDim2.new(0,0,0,-40)
  4053. o40.Size = UDim2.new(1,0,0,25)
  4054. o40.Position = UDim2.new(0,0,0,-40)
  4055. o40.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
  4056. o40.BackgroundTransparency = 0.30000001192093
  4057. o40.BorderColor3 = Color3.new(0.156863, 0.156863, 0.156863)
  4058. o40.BorderSizePixel = 5
  4059. o40.ZIndex = 10
  4060. o41.Name = "Num"
  4061. o41.Parent = o40
  4062. o41.Position = UDim2.new(1,-50,0,0)
  4063. o41.Size = UDim2.new(0,50,1,0)
  4064. o41.Text = "100%"
  4065. o41.Position = UDim2.new(1,-50,0,0)
  4066. o41.BackgroundColor3 = Color3.new(0, 0, 0)
  4067. o41.BackgroundTransparency = 1
  4068. o41.BorderColor3 = Color3.new(0, 0, 0)
  4069. o41.BorderSizePixel = 0
  4070. o41.ZIndex = 10
  4071. o41.Font = Enum.Font.ArialBold
  4072. o41.FontSize = Enum.FontSize.Size24
  4073. o41.TextColor3 = Color3.new(1, 1, 1)
  4074. o41.TextStrokeTransparency = 0
  4075. o41.TextXAlignment = Enum.TextXAlignment.Right
  4076. o42.Name = "Tray"
  4077. o42.Parent = o40
  4078. o42.Position = UDim2.new(0,2,0.5,-10)
  4079. o42.Size = UDim2.new(1,-60,0,20)
  4080. o42.Position = UDim2.new(0,2,0.5,-10)
  4081. o42.BackgroundColor3 = Color3.new(0, 0, 0)
  4082. o42.BackgroundTransparency = 1
  4083. o42.BorderColor3 = Color3.new(0, 0, 0)
  4084. o42.BorderSizePixel = 0
  4085. o42.ZIndex = 10
  4086. o42.ClipsDescendants = true
  4087. o43.Name = "Beat"
  4088. o43.Parent = o42
  4089. o43.Position = UDim2.new(1,0,0,0)
  4090. o43.Size = UDim2.new(0,21,1,0)
  4091. o43.Position = UDim2.new(1,0,0,0)
  4092. o43.BackgroundColor3 = Color3.new(0, 0, 0)
  4093. o43.BackgroundTransparency = 1
  4094. o43.BorderColor3 = Color3.new(0, 0, 0)
  4095. o43.BorderSizePixel = 0
  4096. o43.ZIndex = 10
  4097. o44.Name = "00"
  4098. o44.Parent = o43
  4099. o44.Position = UDim2.new(0,0,0.5,-2)
  4100. o44.Size = UDim2.new(0.047619048506021,0,0,3)
  4101. o44.Position = UDim2.new(0,0,0.5,-2)
  4102. o44.BackgroundColor3 = Color3.new(1, 1, 1)
  4103. o44.BorderColor3 = Color3.new(0, 0, 0)
  4104. o44.BorderSizePixel = 0
  4105. o44.ZIndex = 10
  4106. o45.Name = "01"
  4107. o45.Parent = o43
  4108. o45.Position = UDim2.new(0.047619048506021,0,0.4230769276619,-2)
  4109. o45.Size = UDim2.new(0.047619048506021,0,0,4)
  4110. o45.Position = UDim2.new(0.047619048506021,0,0.4230769276619,-2)
  4111. o45.BackgroundColor3 = Color3.new(1, 1, 1)
  4112. o45.BorderColor3 = Color3.new(0, 0, 0)
  4113. o45.BorderSizePixel = 0
  4114. o45.ZIndex = 10
  4115. o46.Name = "02"
  4116. o46.Parent = o43
  4117. o46.Position = UDim2.new(0.095238097012043,0,0.34615385532379,-2)
  4118. o46.Size = UDim2.new(0.047619048506021,0,0,4)
  4119. o46.Position = UDim2.new(0.095238097012043,0,0.34615385532379,-2)
  4120. o46.BackgroundColor3 = Color3.new(1, 1, 1)
  4121. o46.BorderColor3 = Color3.new(0, 0, 0)
  4122. o46.BorderSizePixel = 0
  4123. o46.ZIndex = 10
  4124. o47.Name = "03"
  4125. o47.Parent = o43
  4126. o47.Position = UDim2.new(0.14285714924335,0,0.26923078298569,-2)
  4127. o47.Size = UDim2.new(0.047619048506021,0,0,4)
  4128. o47.Position = UDim2.new(0.14285714924335,0,0.26923078298569,-2)
  4129. o47.BackgroundColor3 = Color3.new(1, 1, 1)
  4130. o47.BorderColor3 = Color3.new(0, 0, 0)
  4131. o47.BorderSizePixel = 0
  4132. o47.ZIndex = 10
  4133. o48.Name = "04"
  4134. o48.Parent = o43
  4135. o48.Position = UDim2.new(0.19047619402409,0,0.19230769574642,-2)
  4136. o48.Size = UDim2.new(0.047619048506021,0,0,4)
  4137. o48.Position = UDim2.new(0.19047619402409,0,0.19230769574642,-2)
  4138. o48.BackgroundColor3 = Color3.new(1, 1, 1)
  4139. o48.BorderColor3 = Color3.new(0, 0, 0)
  4140. o48.BorderSizePixel = 0
  4141. o48.ZIndex = 10
  4142. o49.Name = "05"
  4143. o49.Parent = o43
  4144. o49.Position = UDim2.new(0.23809523880482,0,0.11538461595774,-2)
  4145. o49.Size = UDim2.new(0.047619048506021,0,0,4)
  4146. o49.Position = UDim2.new(0.23809523880482,0,0.11538461595774,-2)
  4147. o49.BackgroundColor3 = Color3.new(1, 1, 1)
  4148. o49.BorderColor3 = Color3.new(0, 0, 0)
  4149. o49.BorderSizePixel = 0
  4150. o49.ZIndex = 10
  4151. o50.Name = "06"
  4152. o50.Parent = o43
  4153. o50.Position = UDim2.new(0.28571429848671,0,0.038461539894342,-2)
  4154. o50.Size = UDim2.new(0.047619048506021,0,0,4)
  4155. o50.Position = UDim2.new(0.28571429848671,0,0.038461539894342,-2)
  4156. o50.BackgroundColor3 = Color3.new(1, 1, 1)
  4157. o50.BorderColor3 = Color3.new(0, 0, 0)
  4158. o50.BorderSizePixel = 0
  4159. o50.ZIndex = 10
  4160. o51.Name = "07"
  4161. o51.Parent = o43
  4162. o51.Position = UDim2.new(0.33333334326744,0,0,-2)
  4163. o51.Size = UDim2.new(0.047619048506021,0,0,4)
  4164. o51.Position = UDim2.new(0.33333334326744,0,0,-2)
  4165. o51.BackgroundColor3 = Color3.new(1, 1, 1)
  4166. o51.BorderColor3 = Color3.new(0, 0, 0)
  4167. o51.BorderSizePixel = 0
  4168. o51.ZIndex = 10
  4169. o52.Name = "08"
  4170. o52.Parent = o43
  4171. o52.Position = UDim2.new(0.38095238804817,0,0.14285714924335,-2)
  4172. o52.Size = UDim2.new(0.047619048506021,0,0,4)
  4173. o52.Position = UDim2.new(0.38095238804817,0,0.14285714924335,-2)
  4174. o52.BackgroundColor3 = Color3.new(1, 1, 1)
  4175. o52.BorderColor3 = Color3.new(0, 0, 0)
  4176. o52.BorderSizePixel = 0
  4177. o52.ZIndex = 10
  4178. o53.Name = "09"
  4179. o53.Parent = o43
  4180. o53.Position = UDim2.new(0.4285714328289,0,0.28571429848671,-2)
  4181. o53.Size = UDim2.new(0.047619048506021,0,0,4)
  4182. o53.Position = UDim2.new(0.4285714328289,0,0.28571429848671,-2)
  4183. o53.BackgroundColor3 = Color3.new(1, 1, 1)
  4184. o53.BorderColor3 = Color3.new(0, 0, 0)
  4185. o53.BorderSizePixel = 0
  4186. o53.ZIndex = 10
  4187. o54.Name = "10"
  4188. o54.Parent = o43
  4189. o54.Position = UDim2.new(0.47619047760963,0,0.4285714328289,-2)
  4190. o54.Size = UDim2.new(0.047619048506021,0,0,4)
  4191. o54.Position = UDim2.new(0.47619047760963,0,0.4285714328289,-2)
  4192. o54.BackgroundColor3 = Color3.new(1, 1, 1)
  4193. o54.BorderColor3 = Color3.new(0, 0, 0)
  4194. o54.BorderSizePixel = 0
  4195. o54.ZIndex = 10
  4196. o55.Name = "11"
  4197. o55.Parent = o43
  4198. o55.Position = UDim2.new(0.52380955219269,0,0.57142859697342,-2)
  4199. o55.Size = UDim2.new(0.047619048506021,0,0,4)
  4200. o55.Position = UDim2.new(0.52380955219269,0,0.57142859697342,-2)
  4201. o55.BackgroundColor3 = Color3.new(1, 1, 1)
  4202. o55.BorderColor3 = Color3.new(0, 0, 0)
  4203. o55.BorderSizePixel = 0
  4204. o55.ZIndex = 10
  4205. o56.Name = "12"
  4206. o56.Parent = o43
  4207. o56.Position = UDim2.new(0.57142859697342,0,0.71428573131561,-2)
  4208. o56.Size = UDim2.new(0.047619048506021,0,0,4)
  4209. o56.Position = UDim2.new(0.57142859697342,0,0.71428573131561,-2)
  4210. o56.BackgroundColor3 = Color3.new(1, 1, 1)
  4211. o56.BorderColor3 = Color3.new(0, 0, 0)
  4212. o56.BorderSizePixel = 0
  4213. o56.ZIndex = 10
  4214. o57.Name = "13"
  4215. o57.Parent = o43
  4216. o57.Position = UDim2.new(0.61904764175415,0,0.85714286565781,-2)
  4217. o57.Size = UDim2.new(0.047619048506021,0,0,4)
  4218. o57.Position = UDim2.new(0.61904764175415,0,0.85714286565781,-2)
  4219. o57.BackgroundColor3 = Color3.new(1, 1, 1)
  4220. o57.BorderColor3 = Color3.new(0, 0, 0)
  4221. o57.BorderSizePixel = 0
  4222. o57.ZIndex = 10
  4223. o58.Name = "14"
  4224. o58.Parent = o43
  4225. o58.Position = UDim2.new(0.66666668653488,0,0.91666668653488,-2)
  4226. o58.Size = UDim2.new(0.047619048506021,0,0,4)
  4227. o58.Position = UDim2.new(0.66666668653488,0,0.91666668653488,-2)
  4228. o58.BackgroundColor3 = Color3.new(1, 1, 1)
  4229. o58.BorderColor3 = Color3.new(0, 0, 0)
  4230. o58.BorderSizePixel = 0
  4231. o58.ZIndex = 10
  4232. o59.Name = "15"
  4233. o59.Parent = o43
  4234. o59.Position = UDim2.new(0.71428573131561,0,0.83333331346512,-2)
  4235. o59.Size = UDim2.new(0.047619048506021,0,0,4)
  4236. o59.Position = UDim2.new(0.71428573131561,0,0.83333331346512,-2)
  4237. o59.BackgroundColor3 = Color3.new(1, 1, 1)
  4238. o59.BorderColor3 = Color3.new(0, 0, 0)
  4239. o59.BorderSizePixel = 0
  4240. o59.ZIndex = 10
  4241. o60.Name = "16"
  4242. o60.Parent = o43
  4243. o60.Position = UDim2.new(0.76190477609634,0,0.75,-2)
  4244. o60.Size = UDim2.new(0.047619048506021,0,0,4)
  4245. o60.Position = UDim2.new(0.76190477609634,0,0.75,-2)
  4246. o60.BackgroundColor3 = Color3.new(1, 1, 1)
  4247. o60.BorderColor3 = Color3.new(0, 0, 0)
  4248. o60.BorderSizePixel = 0
  4249. o60.ZIndex = 10
  4250. o61.Name = "17"
  4251. o61.Parent = o43
  4252. o61.Position = UDim2.new(0.80952382087708,0,0.66666668653488,-2)
  4253. o61.Size = UDim2.new(0.047619048506021,0,0,4)
  4254. o61.Position = UDim2.new(0.80952382087708,0,0.66666668653488,-2)
  4255. o61.BackgroundColor3 = Color3.new(1, 1, 1)
  4256. o61.BorderColor3 = Color3.new(0, 0, 0)
  4257. o61.BorderSizePixel = 0
  4258. o61.ZIndex = 10
  4259. o62.Name = "18"
  4260. o62.Parent = o43
  4261. o62.Position = UDim2.new(0.85714286565781,0,0.58333331346512,-2)
  4262. o62.Size = UDim2.new(0.047619048506021,0,0,4)
  4263. o62.Position = UDim2.new(0.85714286565781,0,0.58333331346512,-2)
  4264. o62.BackgroundColor3 = Color3.new(1, 1, 1)
  4265. o62.BorderColor3 = Color3.new(0, 0, 0)
  4266. o62.BorderSizePixel = 0
  4267. o62.ZIndex = 10
  4268. o63.Name = "19"
  4269. o63.Parent = o43
  4270. o63.Position = UDim2.new(0.90476191043854,0,0.5,-2)
  4271. o63.Size = UDim2.new(0.047619048506021,0,0,4)
  4272. o63.Position = UDim2.new(0.90476191043854,0,0.5,-2)
  4273. o63.BackgroundColor3 = Color3.new(1, 1, 1)
  4274. o63.BorderColor3 = Color3.new(0, 0, 0)
  4275. o63.BorderSizePixel = 0
  4276. o63.ZIndex = 10
  4277. o64.Name = "20"
  4278. o64.Parent = o43
  4279. o64.Position = UDim2.new(0.95200002193451,0,0.49000000953674,-2)
  4280. o64.Size = UDim2.new(0.047619048506021,0,0,4)
  4281. o64.Position = UDim2.new(0.95200002193451,0,0.49000000953674,-2)
  4282. o64.BackgroundColor3 = Color3.new(1, 1, 1)
  4283. o64.BorderColor3 = Color3.new(0, 0, 0)
  4284. o64.BorderSizePixel = 0
  4285. o64.ZIndex = 10
  4286. o65.Name = "Line"
  4287. o65.Parent = o43
  4288. o65.Position = UDim2.new(1,0,0.5,-2)
  4289. o65.Size = UDim2.new(0,200,0,3)
  4290. o65.Position = UDim2.new(1,0,0.5,-2)
  4291. o65.BackgroundColor3 = Color3.new(1, 1, 1)
  4292. o65.BorderColor3 = Color3.new(0, 0, 0)
  4293. o65.BorderSizePixel = 0
  4294. o65.ZIndex = 10
  4295. o66.Name = "Line"
  4296. o66.Parent = o43
  4297. o66.Position = UDim2.new(0,-200,0.5,-2)
  4298. o66.Size = UDim2.new(0,200,0,3)
  4299. o66.Position = UDim2.new(0,-200,0.5,-2)
  4300. o66.BackgroundColor3 = Color3.new(1, 1, 1)
  4301. o66.BorderColor3 = Color3.new(0, 0, 0)
  4302. o66.BorderSizePixel = 0
  4303. o66.ZIndex = 10
  4304. o67.Name = "Controls"
  4305. o67.Parent = o29
  4306. o67.Position = UDim2.new(0,0,0,-200)
  4307. o67.Size = UDim2.new(1,0,0,120)
  4308. o67.Position = UDim2.new(0,0,0,-200)
  4309. o67.Visible = false
  4310. o67.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
  4311. o67.BackgroundTransparency = 0.30000001192093
  4312. o67.BorderColor3 = Color3.new(0.156863, 0.156863, 0.156863)
  4313. o67.BorderSizePixel = 5
  4314. o67.ZIndex = 10
  4315. o68.Name = "Title"
  4316. o68.Parent = o67
  4317. o68.Size = UDim2.new(1,0,0,15)
  4318. o68.Text = "CONTROLS"
  4319. o68.BackgroundColor3 = Color3.new(1, 1, 1)
  4320. o68.BackgroundTransparency = 1
  4321. o68.ZIndex = 10
  4322. o68.Font = Enum.Font.SourceSansBold
  4323. o68.FontSize = Enum.FontSize.Size14
  4324. o68.TextColor3 = Color3.new(1, 1, 1)
  4325. o69.Name = "Line"
  4326. o69.Parent = o68
  4327. o69.Position = UDim2.new(0,0,1,1)
  4328. o69.Size = UDim2.new(1,0,0,2)
  4329. o69.Text = ""
  4330. o69.Position = UDim2.new(0,0,1,1)
  4331. o69.BackgroundColor3 = Color3.new(1, 1, 0)
  4332. o69.BorderSizePixel = 0
  4333. o69.ZIndex = 10
  4334. o69.Font = Enum.Font.SourceSans
  4335. o69.FontSize = Enum.FontSize.Size14
  4336. o70.Name = "Grenades"
  4337. o70.Parent = o29
  4338. o70.Position = UDim2.new(0,0,0,90)
  4339. o70.Size = UDim2.new(0,175,0,25)
  4340. o70.Position = UDim2.new(0,0,0,90)
  4341. o70.Visible = false
  4342. o70.BackgroundTransparency = 1
  4343. o70.ZIndex = 10
  4344. o71.Name = "Lethals"
  4345. o71.Parent = o70
  4346. o71.Size = UDim2.new(0.5,-2,1,0)
  4347. o71.BackgroundColor3 = Color3.new(1, 1, 1)
  4348. o71.BackgroundTransparency = 0.80000001192093
  4349. o71.BorderSizePixel = 0
  4350. o71.ZIndex = 10
  4351. o72.Name = "Icon"
  4352. o72.Parent = o71
  4353. o72.Position = UDim2.new(0,7,0,2)
  4354. o72.Size = UDim2.new(0,21,0,21)
  4355. o72.Position = UDim2.new(0,7,0,2)
  4356. o72.BackgroundColor3 = Color3.new(1, 1, 1)
  4357. o72.BackgroundTransparency = 1
  4358. o72.ZIndex = 10
  4359. o73.Name = "Mult"
  4360. o73.Parent = o71
  4361. o73.Position = UDim2.new(0.5,-10,0,0)
  4362. o73.Size = UDim2.new(0,20,1,0)
  4363. o73.Text = "X"
  4364. o73.Position = UDim2.new(0.5,-10,0,0)
  4365. o73.BackgroundColor3 = Color3.new(1, 1, 1)
  4366. o73.BackgroundTransparency = 1
  4367. o73.BorderSizePixel = 0
  4368. o73.ZIndex = 10
  4369. o73.Font = Enum.Font.ArialBold
  4370. o73.FontSize = Enum.FontSize.Size18
  4371. o73.TextColor3 = Color3.new(1, 1, 1)
  4372. o74.Name = "Num"
  4373. o74.Parent = o71
  4374. o74.Position = UDim2.new(1,-7,0,0)
  4375. o74.Size = UDim2.new(0,0,1,0)
  4376. o74.Text = "0"
  4377. o74.Position = UDim2.new(1,-7,0,0)
  4378. o74.BackgroundColor3 = Color3.new(1, 1, 1)
  4379. o74.BackgroundTransparency = 1
  4380. o74.ZIndex = 10
  4381. o74.Font = Enum.Font.ArialBold
  4382. o74.FontSize = Enum.FontSize.Size18
  4383. o74.TextColor3 = Color3.new(1, 1, 1)
  4384. o74.TextXAlignment = Enum.TextXAlignment.Right
  4385. o75.Name = "Tacticals"
  4386. o75.Parent = o70
  4387. o75.Position = UDim2.new(0.5,2,0,0)
  4388. o75.Size = UDim2.new(0.5,-2,1,0)
  4389. o75.Position = UDim2.new(0.5,2,0,0)
  4390. o75.BackgroundColor3 = Color3.new(1, 1, 1)
  4391. o75.BackgroundTransparency = 0.80000001192093
  4392. o75.BorderSizePixel = 0
  4393. o75.ZIndex = 10
  4394. o76.Name = "Icon"
  4395. o76.Parent = o75
  4396. o76.Position = UDim2.new(0,7,0,2)
  4397. o76.Size = UDim2.new(0,21,0,21)
  4398. o76.Position = UDim2.new(0,7,0,2)
  4399. o76.BackgroundColor3 = Color3.new(1, 1, 1)
  4400. o76.BackgroundTransparency = 1
  4401. o76.ZIndex = 10
  4402. o77.Name = "Num"
  4403. o77.Parent = o75
  4404. o77.Position = UDim2.new(1,-7,0,0)
  4405. o77.Size = UDim2.new(0,0,1,0)
  4406. o77.Text = "0"
  4407. o77.Position = UDim2.new(1,-7,0,0)
  4408. o77.BackgroundColor3 = Color3.new(1, 1, 1)
  4409. o77.BackgroundTransparency = 1
  4410. o77.ZIndex = 10
  4411. o77.Font = Enum.Font.ArialBold
  4412. o77.FontSize = Enum.FontSize.Size18
  4413. o77.TextColor3 = Color3.new(1, 1, 1)
  4414. o77.TextXAlignment = Enum.TextXAlignment.Right
  4415. o78.Name = "Mult"
  4416. o78.Parent = o75
  4417. o78.Position = UDim2.new(0.5,-10,0,0)
  4418. o78.Size = UDim2.new(0,20,1,0)
  4419. o78.Text = "X"
  4420. o78.Position = UDim2.new(0.5,-10,0,0)
  4421. o78.BackgroundColor3 = Color3.new(1, 1, 1)
  4422. o78.BackgroundTransparency = 1
  4423. o78.BorderSizePixel = 0
  4424. o78.ZIndex = 10
  4425. o78.Font = Enum.Font.ArialBold
  4426. o78.FontSize = Enum.FontSize.Size18
  4427. o78.TextColor3 = Color3.new(1, 1, 1)
  4428. o79.Name = "gunName"
  4429. o79.Parent = o29
  4430. o79.Size = UDim2.new(1,0,0,36)
  4431. o79.BackgroundColor3 = Color3.new(0.972549, 0.972549, 0.972549)
  4432. o79.BackgroundTransparency = 1
  4433. o79.ZIndex = 10
  4434. o80.Name = "Line"
  4435. o80.Parent = o79
  4436. o80.Size = UDim2.new(0,2,1,0)
  4437. o80.Text = ""
  4438. o80.BackgroundColor3 = Color3.new(1, 1, 1)
  4439. o80.BorderSizePixel = 0
  4440. o80.ZIndex = 10
  4441. o80.Font = Enum.Font.SourceSans
  4442. o80.FontSize = Enum.FontSize.Size14
  4443. o81.Name = "Line"
  4444. o81.Parent = o79
  4445. o81.Position = UDim2.new(0,0,1,0)
  4446. o81.Size = UDim2.new(1,0,0,2)
  4447. o81.Text = ""
  4448. o81.Position = UDim2.new(0,0,1,0)
  4449. o81.BackgroundColor3 = Color3.new(1, 1, 1)
  4450. o81.BorderSizePixel = 0
  4451. o81.ZIndex = 10
  4452. o81.Font = Enum.Font.SourceSans
  4453. o81.FontSize = Enum.FontSize.Size14
  4454. o82.Name = "Title"
  4455. o82.Parent = o79
  4456. o82.Position = UDim2.new(0,7,0,0)
  4457. o82.Size = UDim2.new(1,-7,1,0)
  4458. o82.Text = "Gun"
  4459. o82.Position = UDim2.new(0,7,0,0)
  4460. o82.BackgroundColor3 = Color3.new(1, 1, 1)
  4461. o82.BackgroundTransparency = 1
  4462. o82.ZIndex = 10
  4463. o82.Font = Enum.Font.SourceSansBold
  4464. o82.FontSize = Enum.FontSize.Size36
  4465. o82.TextColor3 = Color3.new(1, 1, 1)
  4466. o82.TextStrokeTransparency = 0
  4467. o82.TextXAlignment = Enum.TextXAlignment.Left
  4468. o83.Name = "fireSelect"
  4469. o83.Parent = o15
  4470. o83.Position = UDim2.new(0.5,0,0.5,-18)
  4471. o83.Position = UDim2.new(0.5,0,0.5,-18)
  4472. o83.Visible = false
  4473. o83.BackgroundColor3 = Color3.new(1, 1, 1)
  4474. o83.BackgroundTransparency = 1
  4475. o84.Name = "Modes"
  4476. o84.Parent = o83
  4477. o84.BackgroundColor3 = Color3.new(1, 1, 1)
  4478. o84.BackgroundTransparency = 1
  4479. o85.Name = "Circle"
  4480. o85.Parent = o83
  4481. o85.Position = UDim2.new(0,-60,0,-60)
  4482. o85.Size = UDim2.new(0,120,0,120)
  4483. o85.Position = UDim2.new(0,-60,0,-60)
  4484. o85.BackgroundColor3 = Color3.new(1, 1, 1)
  4485. o85.BackgroundTransparency = 1
  4486. o85.Image = "http://www.roblox.com/asset/?id=55754953"
  4487. o85.ImageTransparency = 0.5
  4488. o86.Name = "Arrow"
  4489. o86.Parent = o83
  4490. o86.Position = UDim2.new(0,-20,0,-140)
  4491. o86.Size = UDim2.new(0,40,0,20)
  4492. o86.Position = UDim2.new(0,-20,0,-140)
  4493. o86.BackgroundColor3 = Color3.new(1, 1, 1)
  4494. o86.BackgroundTransparency = 1
  4495. o86.Image = "http://www.roblox.com/asset/?id=126877530"
  4496. o87.Name = "Scope"
  4497. o87.Parent = o15
  4498. o87.Position = UDim2.new(0,0,0,-36)
  4499. o87.Size = UDim2.new(1,0,1,36)
  4500. o87.Position = UDim2.new(0,0,0,-36)
  4501. o87.BackgroundColor3 = Color3.new(0, 0, 0)
  4502. o87.BackgroundTransparency = 1
  4503. o88.Name = "Steady"
  4504. o88.Parent = o87
  4505. o88.Position = UDim2.new(0.5,-60,0.5,50)
  4506. o88.Size = UDim2.new(0,120,0,20)
  4507. o88.Text = ""
  4508. o88.Position = UDim2.new(0.5,-60,0.5,50)
  4509. o88.Visible = false
  4510. o88.BackgroundColor3 = Color3.new(1, 1, 1)
  4511. o88.BackgroundTransparency = 1
  4512. o88.ZIndex = 9
  4513. o88.Font = Enum.Font.ArialBold
  4514. o88.FontSize = Enum.FontSize.Size14
  4515. o88.TextColor3 = Color3.new(1, 1, 0)
  4516. o88.TextStrokeTransparency = 0
  4517. o89.Name = "Main"
  4518. o89.Parent = o87
  4519. o89.Size = UDim2.new(1,0,1,0)
  4520. o89.Visible = false
  4521. o89.BackgroundColor3 = Color3.new(1, 1, 1)
  4522. o89.BackgroundTransparency = 1
  4523. o90.Name = "ScopeImg2"
  4524. o90.Parent = o89
  4525. o90.Position = UDim2.new(0.5,-10,0,-10)
  4526. o90.Size = UDim2.new(0,20,0,20)
  4527. o90.Position = UDim2.new(0.5,-10,0,-10)
  4528. o90.BackgroundColor3 = Color3.new(0, 0, 0)
  4529. o90.BackgroundTransparency = 1
  4530. o90.Image = "http://www.roblox.com/asset/?id=184922644"
  4531. o91.Name = "ScopeImg1"
  4532. o91.Parent = o89
  4533. o91.Position = UDim2.new(0.5,-10,0,-10)
  4534. o91.Size = UDim2.new(0,20,0,20)
  4535. o91.Position = UDim2.new(0.5,-10,0,-10)
  4536. o91.BackgroundColor3 = Color3.new(0, 0, 0)
  4537. o91.BackgroundTransparency = 1
  4538. o91.Image = "http://www.roblox.com/asset/?id=72002022"
  4539. o92.Name = "F2"
  4540. o92.Parent = o89
  4541. o92.Position = UDim2.new(0,-10,0,-10)
  4542. o92.Size = UDim2.new(0,0,1,20)
  4543. o92.Position = UDim2.new(0,-10,0,-10)
  4544. o92.BackgroundColor3 = Color3.new(0, 0, 0)
  4545. o92.BorderColor3 = Color3.new(0, 0, 0)
  4546. o92.BorderSizePixel = 0
  4547. o93.Name = "F1"
  4548. o93.Parent = o89
  4549. o93.Position = UDim2.new(0,-10,0,-10)
  4550. o93.Size = UDim2.new(0,0,1,20)
  4551. o93.Position = UDim2.new(0,-10,0,-10)
  4552. o93.BackgroundColor3 = Color3.new(0, 0, 0)
  4553. o93.BorderColor3 = Color3.new(0, 0, 0)
  4554. o93.BorderSizePixel = 0
  4555. o94.Name = "Update"
  4556. o94.Parent = o89
  4557. table.insert(cors,coroutine.create(function()
  4558. wait()
  4559. runDummyScript(function()
  4560. local GUI = script.Parent
  4561.  
  4562. function updateScopeDimension()
  4563. GUI.ScopeImg1.Position = UDim2.new(0.5, -10 - (GUI.AbsoluteSize.y / 2), 0, -10)
  4564. GUI.ScopeImg1.Size = UDim2.new(0, 20 + GUI.AbsoluteSize.y, 0, 20 + GUI.AbsoluteSize.y)
  4565. GUI.ScopeImg2.Position = UDim2.new(0.5, -10 - (GUI.AbsoluteSize.y / 2), 0, -10)
  4566. GUI.ScopeImg2.Size = UDim2.new(0, 20 + GUI.AbsoluteSize.y, 0, 20 + GUI.AbsoluteSize.y)
  4567. GUI.F1.Size = UDim2.new(0, 20 + ((GUI.AbsoluteSize.x - GUI.AbsoluteSize.y) / 2), 1, 20)
  4568. GUI.F2.Size = UDim2.new(0, 20 + ((GUI.AbsoluteSize.x - GUI.AbsoluteSize.y) / 2), 1, 20)
  4569. GUI.F2.Position = UDim2.new(1, -10 - ((GUI.AbsoluteSize.x - GUI.AbsoluteSize.y) / 2), 0, -10)
  4570. end
  4571.  
  4572. wait()
  4573.  
  4574. GUI.Changed:connect(updateScopeDimension)
  4575.  
  4576. updateScopeDimension()
  4577. end,o94)
  4578. end))
  4579. o95.Name = "Sens"
  4580. o95.Parent = o15
  4581. o95.Position = UDim2.new(0.5,-50,0.5,50)
  4582. o95.Size = UDim2.new(0,100,0,20)
  4583. o95.Text = "S: 0.3"
  4584. o95.Position = UDim2.new(0.5,-50,0.5,50)
  4585. o95.Visible = false
  4586. o95.BackgroundColor3 = Color3.new(1, 1, 1)
  4587. o95.BackgroundTransparency = 1
  4588. o95.ZIndex = 10
  4589. o95.Font = Enum.Font.SourceSansBold
  4590. o95.FontSize = Enum.FontSize.Size28
  4591. o95.TextColor3 = Color3.new(1, 1, 1)
  4592. o95.TextStrokeTransparency = 0
  4593. o107.Name = "Chamber"
  4594. o107.Parent = o9
  4595. o107.BrickColor = BrickColor.new("Dark stone grey")
  4596. o107.Transparency = 1
  4597. o107.Position = Vector3.new(-142.257553, 3.77966499, 40.1682129)
  4598. o107.Rotation = Vector3.new(180, 0, 90)
  4599. o107.Anchored = true
  4600. o107.CanCollide = false
  4601. o107.FormFactor = Enum.FormFactor.Custom
  4602. o107.Size = Vector3.new(0.210256502, 0.341666162, 0.210256562)
  4603. o107.CFrame = CFrame.new(-142.257553, 3.77966499, 40.1682129, -7.59644536e-07, -1, 7.93234722e-06, -1.00000274, 7.594208e-07, -1.78813934e-07, 1.44541264e-06, -7.94366952e-06, -1.00000262)
  4604. o107.BottomSurface = Enum.SurfaceType.Smooth
  4605. o107.TopSurface = Enum.SurfaceType.Smooth
  4606. o107.Color = Color3.new(0.388235, 0.372549, 0.384314)
  4607. o107.Position = Vector3.new(-142.257553, 3.77966499, 40.1682129)
  4608. o107.Orientation = Vector3.new(0, 180, -90)
  4609. o107.Color = Color3.new(0.388235, 0.372549, 0.384314)
  4610. o108.Parent = o107
  4611. o108.Scale = Vector3.new(0.812498569, 1, 0.81249845)
  4612. o108.Scale = Vector3.new(0.812498569, 1, 0.81249845)
  4613. o109.Name = "A2"
  4614. o109.Parent = o9
  4615. o109.BrickColor = BrickColor.new("Dark stone grey")
  4616. o109.Transparency = 1
  4617. o109.Position = Vector3.new(-142.257553, 3.76939201, 40.1682129)
  4618. o109.Rotation = Vector3.new(180, 0, 90)
  4619. o109.Anchored = true
  4620. o109.CanCollide = false
  4621. o109.FormFactor = Enum.FormFactor.Custom
  4622. o109.Size = Vector3.new(0.210256502, 0.341666162, 0.210256562)
  4623. o109.CFrame = CFrame.new(-142.257553, 3.76939201, 40.1682129, -7.59644536e-07, -1, 7.93234722e-06, -1.00000274, 7.594208e-07, -1.78813934e-07, 1.44541264e-06, -7.94366952e-06, -1.00000262)
  4624. o109.BottomSurface = Enum.SurfaceType.Smooth
  4625. o109.TopSurface = Enum.SurfaceType.Smooth
  4626. o109.Color = Color3.new(0.388235, 0.372549, 0.384314)
  4627. o109.Position = Vector3.new(-142.257553, 3.76939201, 40.1682129)
  4628. o109.Orientation = Vector3.new(0, 180, -90)
  4629. o109.Color = Color3.new(0.388235, 0.372549, 0.384314)
  4630. o110.Parent = o109
  4631. o110.Scale = Vector3.new(0.812498569, 1, 0.81249845)
  4632. o110.Scale = Vector3.new(0.812498569, 1, 0.81249845)
  4633. o111.Name = "A1"
  4634. o111.Parent = o9
  4635. o111.BrickColor = BrickColor.new("Dark stone grey")
  4636. o111.Transparency = 1
  4637. o111.Position = Vector3.new(-142.257553, 3.76939201, 40.1682129)
  4638. o111.Rotation = Vector3.new(-90, -90, 0)
  4639. o111.Anchored = true
  4640. o111.CanCollide = false
  4641. o111.FormFactor = Enum.FormFactor.Custom
  4642. o111.Size = Vector3.new(0.210256502, 0.512499154, 0.210256562)
  4643. o111.CFrame = CFrame.new(-142.257553, 3.76939201, 40.1682129, -3.01952241e-10, 9.82800157e-06, -1, 1.00000274, 1.02818012e-06, -5.14774001e-10, -2.68220901e-07, -1.0000025, -9.83932659e-06)
  4644. o111.BottomSurface = Enum.SurfaceType.Smooth
  4645. o111.TopSurface = Enum.SurfaceType.Smooth
  4646. o111.Color = Color3.new(0.388235, 0.372549, 0.384314)
  4647. o111.Position = Vector3.new(-142.257553, 3.76939201, 40.1682129)
  4648. o111.Orientation = Vector3.new(0, -90, 90)
  4649. o111.Color = Color3.new(0.388235, 0.372549, 0.384314)
  4650. o112.Parent = o111
  4651. o112.Scale = Vector3.new(0.812498569, 1, 0.81249845)
  4652. o112.Scale = Vector3.new(0.812498569, 1, 0.81249845)
  4653. o115.Name = "AimPart"
  4654. o115.Parent = o9
  4655. o115.BrickColor = BrickColor.new("Dark stone grey")
  4656. o115.Transparency = 1
  4657. o115.Position = Vector3.new(-142.797318, 4.96750784, 41.0058594)
  4658. o115.Anchored = true
  4659. o115.CanCollide = false
  4660. o115.FormFactor = Enum.FormFactor.Custom
  4661. o115.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
  4662. o115.CFrame = CFrame.new(-142.797318, 4.96750784, 41.0058594, 1, 2.40213822e-08, 1.12754587e-05, -2.84185155e-08, 1, 7.10599124e-07, -1.12755069e-05, -7.11530447e-07, 0.99999994)
  4663. o115.BottomSurface = Enum.SurfaceType.Smooth
  4664. o115.TopSurface = Enum.SurfaceType.Smooth
  4665. o115.Color = Color3.new(0.388235, 0.372549, 0.384314)
  4666. o115.Position = Vector3.new(-142.797318, 4.96750784, 41.0058594)
  4667. o115.Color = Color3.new(0.388235, 0.372549, 0.384314)
  4668. o116.Parent = o115
  4669. o117.Name = "Handle"
  4670. o117.Parent = o9
  4671. o117.BrickColor = BrickColor.new("Dark stone grey")
  4672. o117.Transparency = 1
  4673. o117.Position = Vector3.new(-142.797318, 4.47750807, 40.5458984)
  4674. o117.Anchored = true
  4675. o117.CanCollide = false
  4676. o117.FormFactor = Enum.FormFactor.Custom
  4677. o117.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
  4678. o117.CFrame = CFrame.new(-142.797318, 4.47750807, 40.5458984, 1, 2.40213822e-08, 1.12754587e-05, -2.84185155e-08, 1, 7.10599124e-07, -1.12755069e-05, -7.11530447e-07, 0.99999994)
  4679. o117.BottomSurface = Enum.SurfaceType.Smooth
  4680. o117.TopSurface = Enum.SurfaceType.Smooth
  4681. o117.Color = Color3.new(0.388235, 0.372549, 0.384314)
  4682. o117.Position = Vector3.new(-142.797318, 4.47750807, 40.5458984)
  4683. o117.Color = Color3.new(0.388235, 0.372549, 0.384314)
  4684. o118.Parent = o117
  4685. o119.Name = "FireSound"
  4686. o119.Parent = o117
  4687. o119.Pitch = 1.5
  4688. o119.SoundId = "rbxassetid://210112900"
  4689. o119.Volume = 1
  4690. o120.Name = "ReloadSound"
  4691. o120.Parent = o117
  4692. o120.SoundId = "rbxassetid://517463726"
  4693. o120.Volume = 1
  4694. o122.Name = "Ammo"
  4695. o122.Parent = o9
  4696. o122.Value = 1500
  4697. o123.Name = "ClipSize"
  4698. o123.Parent = o9
  4699. o123.Value = 149
  4700. o124.Name = "LethalGrenades"
  4701. o124.Parent = o9
  4702. o125.Name = "StoredAmmo"
  4703. o125.Parent = o9
  4704. o125.Value = 45000
  4705. o126.Name = "TacticalGrenades"
  4706. o126.Parent = o9
  4707. o127.Name = "[[README]]"
  4708. o127.Parent = o9
  4709. table.insert(cors,coroutine.create(function()
  4710. wait()
  4711. runDummyScript(function()
  4712. --[[
  4713.  
  4714. VERSION: v0.0.4
  4715.  
  4716. ----------[ UPDATES ]----------------------------------------------------
  4717.  
  4718. Pre-Release: -Added a copyright
  4719. -fixed the issue where you couldn't run when you selected the tool
  4720. -Added an ADS key and allowed ADS to either be toggle or hold
  4721. -Made the Ammo values external so they can be changed by outside scripts
  4722.  
  4723. v0.0.2: -Created new arms for the gun
  4724. -Fixed an issue where the arms would glitch if PlayerAnimations was set to false and the gun was fired
  4725. -Updated credit security
  4726. -Put the Arm cframes in the SETTINGS
  4727. -Made the stance changing animations slightly smoother
  4728. -Added bullet drop
  4729. -Fixed some bullet hit handling code
  4730. -Made the torso being able to rotate while sitting down a setting
  4731. -Added bullet settings
  4732. -Added shockwave settings
  4733. -Added an Explosive guntype
  4734. -Added a version label in the Gui
  4735.  
  4736. v0.0.3: -Added an option to have player arms
  4737. -Added grenades / throwables
  4738. -Fixed the issue where if a player left a server without deselecting the gun, the bullet trails still remained
  4739. -Added Gui Scopes
  4740. -Fixed the issue where the guns would glitch if you switched weapons too fast
  4741.  
  4742. v0.0.4: -Updated the Gui
  4743. -Added a "Table Of Contents" in the clientMain
  4744. -Added PLUGINS
  4745. -Added the Arm CFrame when Running in the SETTINGS
  4746. -Added Mouse Sensitivity settings
  4747. -Fixed an issue where a humanoid wouldn't be damaged by bullets if there was no space between a wall and the humanoid
  4748. -Fixed the issue where you couldn't steady the scope if the steady key was different from the run key
  4749. -Added an example flashlight and laser (You can delete them and the gun will still work fine)
  4750. -Moved the movement animations into a separate module script for easier editing
  4751. -Added a single bullet mag option. It allows people to make guns where the mag is the bullet itself (i.e. arrows)
  4752. -Moved grenades into a seperate folder and made them server-side so they don't get deleted when you die or switch guns
  4753. -Added an option for a second knife animation
  4754. -Added a setting to change the throwing speed of the grenades
  4755. -Added an auto-knife feature
  4756. -Added a setting for whether the gun can ADS or not
  4757. -Added a flashbang and a molotov to the grenade list
  4758. -Fixed an issue where bullets could only penetrate 1 wall
  4759. -Added gun sway for when you move the gun around
  4760. -Made the camera type scriptable when the gun is selected
  4761. -Moved the ignore model creating code into a seperate server script so the ReadMe can be deleted
  4762. -Redesigned the animations so the transitions between idling, walking, and running are smooth instead of choppy like previously
  4763. -Added a fire select option
  4764. -Added an equip animation option
  4765. -Added a crawling animation option
  4766. -Fixed the issue where you could dive and jump at the same time
  4767. -Moved the reload animation into the ANIMATIONS modulescript for easier editing
  4768. -Added an option to enable reloading while running
  4769. -Added an option to enable firing while running
  4770. -Redesigned the recoil animation and based it more on battlefield
  4771. -Edited the reload so if a bullet is already chambered and you reload the ammo will be the ClipSize + 1
  4772. -Fixed the issue where the ammo would go to 0 if you stopped the reload
  4773. -Fixed the issue where if you stopped the reload before you put in a new mag the gun would take another full clipsize from the storedammo
  4774. -Fixed an issue where if the gun was removed without being deselected, the camera would break
  4775. -Got rid of the gunName and gunDescription settings because they're unnecessary and annoying to change
  4776. -Moved bullet impact object creation to server side
  4777. -Added a bullet smoke impact setting
  4778. -Added a blood particle setting that appears on a player when they're shot
  4779. -Updated the scope
  4780. -Added CanCollide, transparency, and custom ignore settings to the penetration settings
  4781. -Moved trail creation to server side to prevent client lag
  4782. -Fixed an issue where shooting a player's hat would do damage
  4783.  
  4784. -------------------------------------------------------------------------
  4785.  
  4786. Hello there!
  4787.  
  4788. Glad to know you're using my one and only Gun Kit!
  4789.  
  4790. Even though this kit has many features and is rather advanced, it's pretty easy to use
  4791.  
  4792. There are 4 things that this gun needs in order to function:
  4793. One brick called "AimPart"
  4794. At least one brick where the first 3 letters are "Mag"
  4795. One brick called "Handle"
  4796. One brick called "Main"
  4797.  
  4798. The AimPart is what the gun will use to aim down the sights. When you aim down your sights, this brick will be in the center
  4799. of the player's head. It basically allows the gun to have any type of sight, which can be placed anywhere on the gun. As long as
  4800. the AimPart is aligned with the sight, the gun will aim down the sights properly.
  4801. (NOTE: Make sure the AimPart is behind the Sight and the FRONT of the AimPart is facing the Sight)
  4802.  
  4803. The Mag is what the gun will move around when you reload the gun. If the mag is made up of more than one brick, make sure the first
  4804. 3 leters of the bricks are also "Mag" so that the gun will move them around. If you set ReloadAnimation to false in the SETTINGS, you don't
  4805. need any bricks called "Mag". But if ReloadAnimation is set to true, the gun needs at least one brick called "Mag" or it will break. It doesn't
  4806. matter what comes after the "Mag", you can have a Mag brick called "Mag1" and another Mag brick called "MagA". As long as the first three letters are
  4807. "Mag", then the gun will recognize it as a Mag
  4808.  
  4809. The Handle is obviously the most important part of the Gun. Without it, the tool itself wouldn't work. It's that simple
  4810. (NOTE: If you want a sound to play when you fire, name it "FireSound" and place it in the Handle. If you want a sound to play when
  4811. you reload, name it "ReloadSound" and place it in the Handle)
  4812.  
  4813. The Main is the brick where the bullets will originate from. It's also the brick where the flash effects are kept.
  4814. (NOTE: If you want a muzzle flash effects, put them in the Main and call them "FlashFX". Also make sure they have an "Enabled"
  4815. property so that the script can enable and disable them)
  4816.  
  4817. ----------[ INSTRUCTIONS ]-----------------------------------------------
  4818.  
  4819. HOW TO USE THIS KIT:
  4820. 1) If the gun already has a Handle, make sure it is facing forward. If the gun doesn't have a Handle, create one and place
  4821. it wherever you like, and make sure it is facing forward
  4822.  
  4823. 2) If the gun already has a brick called "AimPart", move it to where you would like, and make sure it is facing the sight.
  4824. If the gun doesn't have a brick called "AimPart", create one and move it where you would like it to be, and make sure
  4825. it is facing the sight
  4826.  
  4827. 3) If the gun already has a brick called "Main", move it to the very front of the gun. If the gun doesn't have a brick
  4828. called "Main", create one and move it to the very front of the gun
  4829.  
  4830. 4) If ReloadAnimation is set to true in the SETTINGS, make sure the gun has at least one brick called "Mag". If
  4831. ReloadAnimation is set to false, the gun doesn't need any bricks called "Mag".
  4832.  
  4833. 5) Open the SETTINGS and edit them however you like
  4834.  
  4835. That's it! Only 5 steps! It's not that complicated, just follow the Directions and it should work fine. If you have any questions /
  4836. comments / concerns, message me.
  4837.  
  4838. ______ ______ __ ______ _ ______
  4839. / _/ _/ /_ __/_ _______/ /_ ____ / ____/_ _______(_)___ ____ / / /
  4840. / // / / / / / / / ___/ __ \/ __ \/ /_ / / / / ___/ / __ \/ __ \ / // /
  4841. / // / / / / /_/ / / / /_/ / /_/ / __/ / /_/ (__ ) / /_/ / / / / / // /
  4842. / // / /_/ \__,_/_/ /_.___/\____/_/ \__,_/____/_/\____/_/ /_/ _/ // /
  4843. /__/__/ /__/__/
  4844.  
  4845. --]]
  4846. end,o127)
  4847. end))
  4848. o128.Name = "serverMain"
  4849. o128.Parent = o9
  4850. table.insert(cors,coroutine.create(function()
  4851. wait()
  4852. runDummyScript(function()
  4853. local Plyr = script:WaitForChild("Plyr")
  4854.  
  4855. local Gun = script.Parent
  4856. local Handle = Gun:WaitForChild("Handle")
  4857.  
  4858. local V3 = Vector3.new
  4859. local CF, CFANG = CFrame.new, CFrame.Angles
  4860.  
  4861. local RAD = math.rad
  4862.  
  4863. local numLerp = function(A, B, Alpha)
  4864. return A + (B - A) * Alpha
  4865. end
  4866.  
  4867. local inList = function(Element, List)
  4868. for _, v in pairs(List) do
  4869. if v == Element then
  4870. return true
  4871. end
  4872. end
  4873. return false
  4874. end
  4875.  
  4876. local getObject = function(Model, Class, Name)
  4877. for _, v in pairs(Model:GetChildren()) do
  4878. if v:IsA(Class) and v.Name == Name then
  4879. return v
  4880. end
  4881. end
  4882. return nil
  4883. end
  4884.  
  4885. ----------------------------------------------------------------------
  4886. --------------------[ IGNORE MODEL HANDLING ]-------------------------
  4887. ----------------------------------------------------------------------
  4888.  
  4889. wait(math.random(0, 20) / 40) --This is to prevent more than one ignoreModel from being created
  4890.  
  4891. if _G.ignoreCode then --If the ignoreCode already exists, then the script creates the ignoreModel
  4892. --[[
  4893. The purpose of this is so that every gun in a game that uses this gun kit will share one ignoreModel. That way,
  4894. bullet trails, bullet holes, and other fake arms will be ignored by the gun which makes the bullets more likely to
  4895. hit a character part
  4896. --]]
  4897. if (not game.Workspace:FindFirstChild("ignoreModel_".._G.ignoreCode)) then
  4898. local ignoreModel = Instance.new("Model")
  4899. ignoreModel.Name = "ignoreModel_".._G.ignoreCode
  4900. ignoreModel.Parent = game.Workspace
  4901.  
  4902. local grenadeFolder = Instance.new("Model")
  4903. grenadeFolder.Name = "grenadeFolder"
  4904. grenadeFolder.Parent = ignoreModel
  4905.  
  4906. spawn(function()
  4907. while true do
  4908. ignoreModel.Parent = game.Workspace
  4909. grenadeFolder.Parent = ignoreModel
  4910. wait(1 / 20)
  4911. end
  4912. end)
  4913. end
  4914.  
  4915. script.Parent:WaitForChild("clientMain"):WaitForChild("ignoreCode").Value = _G.ignoreCode
  4916. else
  4917. --[[
  4918. If there isn't already an ignoreCode, then this creates one. The purpose of it being random is so that if there is
  4919. an ignoreModel for something else in the game, the script won't end up placing the ignored objects in that ignoreModel
  4920. --]]
  4921. _G.ignoreCode = math.random(1, 1e4)
  4922.  
  4923. if (not game.Workspace:FindFirstChild("ignoreModel_".._G.ignoreCode)) then
  4924. local ignoreModel = Instance.new("Model")
  4925. ignoreModel.Name = "ignoreModel_".._G.ignoreCode
  4926. ignoreModel.Parent = game.Workspace
  4927.  
  4928. local grenadeFolder = Instance.new("Model")
  4929. grenadeFolder.Name = "grenadeFolder"
  4930. grenadeFolder.Parent = ignoreModel
  4931.  
  4932. spawn(function()
  4933. while true do
  4934. ignoreModel.Parent = game.Workspace
  4935. grenadeFolder.Parent = ignoreModel
  4936. wait(1 / 20)
  4937. end
  4938. end)
  4939. end
  4940.  
  4941. script.Parent:WaitForChild("clientMain"):WaitForChild("ignoreCode").Value = _G.ignoreCode
  4942. end
  4943.  
  4944. spawn(function()
  4945. --[[
  4946. This function deletes any Player Folders that were left in the ignoreModel because the player left the game without
  4947. deselecting the Gun first
  4948. --]]
  4949. repeat wait() until _G.ignoreCode
  4950. local ignoreModel = game.Workspace:WaitForChild("ignoreModel_".._G.ignoreCode)
  4951. while true do
  4952. for _, gunIgnore in pairs(ignoreModel:GetChildren()) do
  4953. if gunIgnore.Name ~= "grenadeFolder" then
  4954. if (not game.Players:FindFirstChild(gunIgnore.Name:sub(11))) then
  4955. gunIgnore:Destroy()
  4956. end
  4957. end
  4958. end
  4959. wait(1 / 20)
  4960. end
  4961. end)
  4962.  
  4963. ----------------------------------------------------------------------
  4964. --------------------[ RESET CAMERA ]----------------------------------
  4965. ----------------------------------------------------------------------
  4966.  
  4967. Gun.ChildRemoved:connect(function(Child)
  4968. if Child == Handle and Plyr.Value then
  4969. local ignoreCode = Gun:WaitForChild("clientMain"):WaitForChild("ignoreCode").Value
  4970. local resetCam = script:WaitForChild("resetCam")
  4971. resetCam:WaitForChild("ignoreCode").Value = ignoreCode
  4972. resetCam.Parent = Plyr.Value.PlayerGui
  4973. end
  4974. end)
  4975.  
  4976. ----------------------------------------------------------------------
  4977. --------------------[ GET WELD CFRAMES ]------------------------------
  4978. ----------------------------------------------------------------------
  4979.  
  4980. for _, v in pairs(Gun:GetChildren()) do
  4981. if v:IsA("BasePart") and v ~= Handle then
  4982. if v:FindFirstChild("mainWeld") then v.mainWeld:Destroy() end
  4983. if (not v:FindFirstChild("weldCF")) then
  4984. local weldCF = Instance.new("CFrameValue")
  4985. weldCF.Name = "weldCF"
  4986. weldCF.Value = Handle.CFrame:toObjectSpace(v.CFrame)
  4987. weldCF.Parent = v
  4988. end
  4989. if string.sub(v.Name, 1, 3) == "Mag" then
  4990. if (not v:FindFirstChild("magTrans")) then
  4991. local magTrans = Instance.new("NumberValue")
  4992. magTrans.Name = "magTrans"
  4993. magTrans.Value = v.Transparency
  4994. magTrans.Parent = v
  4995. end
  4996. end
  4997. v.Anchored = true
  4998. v.CanCollide = false
  4999. end
  5000. end
  5001. Handle.Anchored = false
  5002. Handle.CanCollide = true
  5003.  
  5004. ----------------------------------------------------------------------
  5005. --------------------[ GUNSETUP HANDLING ]-----------------------------
  5006. ----------------------------------------------------------------------
  5007.  
  5008. local gunSetup = script:WaitForChild("gunSetup")
  5009. function gunSetup.OnServerInvoke(Player, Vars)
  5010.  
  5011. --------------------[ CREATING IGNORE MODELS ]--------------------------------
  5012.  
  5013. local gunIgnore = Instance.new("Model")
  5014. gunIgnore.Name = "gunIgnore_"..Player.Name
  5015. gunIgnore.Parent = Vars.ignoreModel
  5016.  
  5017. --------------------[ MODIFYING THE PLAYER ]----------------------------------
  5018.  
  5019. Vars.Humanoid.AutoRotate = false
  5020.  
  5021. Vars.Shoulders.Right.Part1 = nil
  5022. Vars.Shoulders.Left.Part1 = nil
  5023.  
  5024. local playerFolder = Instance.new("Model")
  5025. playerFolder.Name = "playerFolder"
  5026. playerFolder.Parent = gunIgnore
  5027.  
  5028. local headBase = Instance.new("Part")
  5029. headBase.Transparency = 1
  5030. headBase.Name = "headBase"
  5031. headBase.CanCollide = false
  5032. headBase.FormFactor = Enum.FormFactor.Custom
  5033. headBase.Size = V3(0.2, 0.2, 0.2)
  5034. headBase.BottomSurface = Enum.SurfaceType.Smooth
  5035. headBase.TopSurface = Enum.SurfaceType.Smooth
  5036. headBase.Parent = playerFolder
  5037.  
  5038. local headWeld = Instance.new("Weld")
  5039. headWeld.Part0 = Vars.Torso
  5040. headWeld.Part1 = headBase
  5041. headWeld.C0 = CF(0, 1.5, 0)
  5042. headWeld.Parent = Vars.Torso
  5043.  
  5044. local headWeld2 = Instance.new("Weld")
  5045. headWeld2.Part0 = headBase
  5046. headWeld2.Part1 = Vars.Head
  5047. headWeld2.Parent = headBase
  5048.  
  5049. local animBase = Instance.new("Part")
  5050. animBase.Transparency = 1
  5051. animBase.Name = "animBase"
  5052. animBase.CanCollide = false
  5053. animBase.FormFactor = Enum.FormFactor.Custom
  5054. animBase.Size = V3(0.2, 0.2, 0.2)
  5055. animBase.BottomSurface = Enum.SurfaceType.Smooth
  5056. animBase.TopSurface = Enum.SurfaceType.Smooth
  5057. animBase.Parent = playerFolder
  5058.  
  5059. local animWeld = Instance.new("Weld")
  5060. animWeld.Part0 = animBase
  5061. animWeld.Part1 = headBase
  5062. animWeld.Parent = animBase
  5063.  
  5064. local armBase = Instance.new("Part")
  5065. armBase.Transparency = 1
  5066. armBase.Name = "ArmBase"
  5067. armBase.CanCollide = false
  5068. armBase.FormFactor = Enum.FormFactor.Custom
  5069. armBase.Size = V3(0.2, 0.2, 0.2)
  5070. armBase.BottomSurface = Enum.SurfaceType.Smooth
  5071. armBase.TopSurface = Enum.SurfaceType.Smooth
  5072. armBase.Parent = playerFolder
  5073.  
  5074. local ABWeld = Instance.new("Weld")
  5075. ABWeld.Part0 = armBase
  5076. ABWeld.Part1 = animBase
  5077. ABWeld.Parent = armBase
  5078.  
  5079. local LArmBase = Instance.new("Part")
  5080. LArmBase.Transparency = 1
  5081. LArmBase.Name = "LArmBase"
  5082. LArmBase.CanCollide = false
  5083. LArmBase.FormFactor = Enum.FormFactor.Custom
  5084. LArmBase.Size = V3(0.2, 0.2, 0.2)
  5085. LArmBase.BottomSurface = Enum.SurfaceType.Smooth
  5086. LArmBase.TopSurface = Enum.SurfaceType.Smooth
  5087. LArmBase.Parent = playerFolder
  5088.  
  5089. local RArmBase = Instance.new("Part")
  5090. RArmBase.Transparency = 1
  5091. RArmBase.Name = "RArmBase"
  5092. RArmBase.CanCollide = false
  5093. RArmBase.FormFactor = Enum.FormFactor.Custom
  5094. RArmBase.Size = V3(0.2, 0.2, 0.2)
  5095. RArmBase.BottomSurface = Enum.SurfaceType.Smooth
  5096. RArmBase.TopSurface = Enum.SurfaceType.Smooth
  5097. RArmBase.Parent = playerFolder
  5098.  
  5099. local LWeld = Instance.new("Weld")
  5100. LWeld.Name = "LWeld"
  5101. LWeld.Part0 = armBase
  5102. LWeld.Part1 = LArmBase
  5103. LWeld.C0 = Vars.armC0[1]
  5104. LWeld.C1 = Vars.leftArmC1
  5105. LWeld.Parent = armBase
  5106.  
  5107. local RWeld = Instance.new("Weld")
  5108. RWeld.Name = "RWeld"
  5109. RWeld.Part0 = armBase
  5110. RWeld.Part1 = RArmBase
  5111. RWeld.C0 = Vars.armC0[2]
  5112. RWeld.C1 = Vars.rightArmC1
  5113. RWeld.Parent = armBase
  5114.  
  5115. local LWeld2 = Instance.new("Weld")
  5116. LWeld2.Name = "LWeld"
  5117. LWeld2.Part0 = LArmBase
  5118. LWeld2.Part1 = Vars.LArm
  5119. LWeld2.Parent = LArmBase
  5120.  
  5121. local RWeld2 = Instance.new("Weld")
  5122. RWeld2.Name = "RWeld"
  5123. RWeld2.Part0 = RArmBase
  5124. RWeld2.Part1 = Vars.RArm
  5125. RWeld2.Parent = RArmBase
  5126.  
  5127. local LLegWeld = Instance.new("Weld")
  5128. LLegWeld.Name = "LLegWeld"
  5129. LLegWeld.Part0 = Vars.Torso
  5130. LLegWeld.Part1 = nil
  5131. LLegWeld.C0 = CF(-0.5, -2, 0)
  5132. LLegWeld.Parent = Vars.Torso
  5133.  
  5134. local RLegWeld = Instance.new("Weld")
  5135. RLegWeld.Name = "RLegWeld"
  5136. RLegWeld.Part0 = Vars.Torso
  5137. RLegWeld.Part1 = nil
  5138. RLegWeld.C0 = CF(0.5, -2, 0)
  5139. RLegWeld.Parent = Vars.Torso
  5140.  
  5141. for _, Tab in pairs(Vars.gunParts) do
  5142. Tab.Obj.Anchored = false
  5143. local Weld = Instance.new("Weld")
  5144. Weld.Name = "mainWeld"
  5145. Weld.Part0 = Vars.Handle
  5146. Weld.Part1 = Tab.Obj
  5147. Weld.C0 = Tab.Obj.weldCF.Value
  5148. Weld.Parent = Vars.Handle
  5149. Tab.Weld = Weld
  5150. end
  5151.  
  5152. return gunIgnore, playerFolder, headWeld, headWeld2, animWeld, ABWeld, LWeld, RWeld, LWeld2, RWeld2, LLegWeld, RLegWeld, Vars.gunParts
  5153. end
  5154.  
  5155. ----------------------------------------------------------------------
  5156. --------------------[ TWEENJOINT HANDLING ]---------------------------
  5157. ----------------------------------------------------------------------
  5158.  
  5159. local createTweenIndicator = script:WaitForChild("createTweenIndicator")
  5160. function createTweenIndicator.OnServerInvoke(_, Joint, newCode)
  5161. local tweenIndicator = nil
  5162. if (not Joint:findFirstChild("tweenCode")) then --If the joint isn't being tweened, then
  5163. tweenIndicator = Instance.new("IntValue")
  5164. tweenIndicator.Name = "tweenCode"
  5165. tweenIndicator.Value = newCode
  5166. tweenIndicator.Parent = Joint
  5167. else
  5168. tweenIndicator = Joint.tweenCode
  5169. tweenIndicator.Value = newCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
  5170. end
  5171. return tweenIndicator
  5172. end
  5173.  
  5174. local lerpCF = script:WaitForChild("lerpCF")
  5175. function lerpCF.OnServerInvoke(_, Joint, Prop, startCF, endCF, Alpha)
  5176. spawn(function()
  5177. Joint[Prop] = startCF:lerp(endCF, Alpha)
  5178. end)
  5179. end
  5180.  
  5181. local deleteTweenIndicator = script:WaitForChild("deleteTweenIndicator")
  5182. function deleteTweenIndicator.OnServerInvoke(_, tweenIndicator, newCode)
  5183. if tweenIndicator.Value == newCode then --If this tween functions was the last one called on a joint then it will remove the code
  5184. tweenIndicator:Destroy()
  5185. end
  5186. end
  5187.  
  5188. ----------------------------------------------------------------------
  5189. --------------------[ BULLET IMPACT HANDLING ]------------------------
  5190. ----------------------------------------------------------------------
  5191.  
  5192. local createBulletImpact = script:WaitForChild("createBulletImpact")
  5193. createBulletImpact.OnServerEvent:connect(function(_, H, P, N, D, humanoidFound, gunIgnore, S)
  5194. local surfaceCF = CF(P, P + N)
  5195. ----------------------------------------------------------------------------------
  5196. --Creating the bullet hole--------------------------------------------------------
  5197. ----------------------------------------------------------------------------------
  5198. if S.bulletHoles and (not humanoidFound) then
  5199. local Hole = Instance.new("Part")
  5200. Hole.Transparency = 1
  5201. Hole.Anchored = true
  5202. Hole.CanCollide = false
  5203. Hole.FormFactor = "Custom"
  5204. Hole.Size = V3(1, 1, 0.2)
  5205. Hole.TopSurface = 0
  5206. Hole.BottomSurface = 0
  5207. local Mesh = Instance.new("BlockMesh")
  5208. Mesh.Offset = V3(0, 0, -0.05)
  5209. Mesh.Scale = V3(S.holeSettings.Size, S.holeSettings.Size, 0)
  5210. Mesh.Parent = Hole
  5211. local Decal = Instance.new("Decal")
  5212. Decal.Face = Enum.NormalId.Front
  5213. Decal.Texture = S.holeSettings.Texture
  5214. Decal.Parent = Hole
  5215. Hole.Parent = gunIgnore
  5216. Hole.CFrame = surfaceCF
  5217. if (not H.Anchored) then
  5218. local Weld = Instance.new("Weld", Hole)
  5219. Weld.Part0 = H
  5220. Weld.Part1 = Hole
  5221. Weld.C0 = H.CFrame:toObjectSpace(surfaceCF)
  5222. Hole.Anchored = false
  5223. end
  5224. delay(S.holeSettings.visibleTime, function()
  5225. if S.holeSettings.disappearTime > 0 then
  5226. local t0 = tick()
  5227. while true do
  5228. local Alpha = math.min((tick() - t0) / S.holeSettings.disappearTime, 1)
  5229. Decal.Transparency = numLerp(0, 1, Alpha)
  5230. if Alpha == 1 then break end
  5231. wait()
  5232. end
  5233. Hole:Destroy()
  5234. else
  5235. Hole:Destroy()
  5236. end
  5237. end)
  5238. end
  5239. ----------------------------------------------------------------------------------
  5240. --Creating the spark effect-------------------------------------------------------
  5241. ----------------------------------------------------------------------------------
  5242. if S.bulletSparks and (not humanoidFound) and inList(H.Material, S.sparkSettings.Materials) then
  5243. local Sparks = Instance.new("Part")
  5244. Sparks.Transparency = 1
  5245. Sparks.Anchored = true
  5246. Sparks.CanCollide = false
  5247. Sparks.FormFactor = "Custom"
  5248. Sparks.Size = V3(1, 1, 1)
  5249. Sparks.TopSurface = 0
  5250. Sparks.BottomSurface = 0
  5251.  
  5252. local Particles = nil
  5253. if S.customSparks then
  5254. Particles = getObject(game.ServerStorage, "ParticleEmitter", "bulletSpark"):Clone()
  5255. else
  5256. Particles = Instance.new("ParticleEmitter")
  5257. Particles.Color = ColorSequence.new(S.sparkSettings.Color.Start, S.sparkSettings.Color.End)
  5258. Particles.LightEmission = 1
  5259. Particles.Size = NumberSequence.new(
  5260. {
  5261. NumberSequenceKeypoint.new(0, S.sparkSettings.Size, 0.25);
  5262. NumberSequenceKeypoint.new(1, 0);
  5263. }
  5264. )
  5265. Particles.Texture = S.sparkSettings.Texture
  5266. Particles.Transparency = NumberSequence.new(0)
  5267. Particles.Acceleration = V3(0, -196.2, 0)
  5268. Particles.EmissionDirection = Enum.NormalId.Front
  5269. Particles.Lifetime = NumberRange.new(S.sparkSettings.Lifetime - 0.05, S.sparkSettings.Lifetime + 0.05)
  5270. Particles.Rate = S.sparkSettings.Rate
  5271. Particles.Rotation = NumberRange.new(0, 360)
  5272. Particles.Speed = NumberRange.new(S.sparkSettings.Speed - 5, S.sparkSettings.Speed + 5)
  5273. Particles.VelocitySpread = S.sparkSettings.Spread
  5274. end
  5275. Particles.Parent = Sparks
  5276.  
  5277. Sparks.Parent = gunIgnore
  5278. Sparks.CFrame = surfaceCF
  5279. if (not H.Anchored) then
  5280. local Weld = Instance.new("Weld", Sparks)
  5281. Weld.Part0 = H
  5282. Weld.Part1 = Sparks
  5283. Weld.C0 = H.CFrame:toObjectSpace(surfaceCF)
  5284. Sparks.Anchored = false
  5285. end
  5286. delay(0.1, function()
  5287. Particles.Enabled = false
  5288. wait(Particles.Lifetime.Max)
  5289. Sparks:Destroy()
  5290. end)
  5291. end
  5292. ----------------------------------------------------------------------------------
  5293. --Creating the smoke effect-------------------------------------------------------
  5294. ----------------------------------------------------------------------------------
  5295. if S.bulletSmoke and (not humanoidFound) then
  5296. local Smoke = Instance.new("Part")
  5297. Smoke.Transparency = 1
  5298. Smoke.Anchored = true
  5299. Smoke.CanCollide = false
  5300. Smoke.FormFactor = "Custom"
  5301. Smoke.Size = V3(1, 1, 1)
  5302. Smoke.TopSurface = 0
  5303. Smoke.BottomSurface = 0
  5304.  
  5305. local Particles = Instance.new("ParticleEmitter")
  5306. Particles.Color = ColorSequence.new(S.smokeSettings.objColor and H.Color or S.smokeSettings.Color)
  5307. Particles.LightEmission = 0
  5308. Particles.Size = NumberSequence.new(
  5309. {
  5310. NumberSequenceKeypoint.new(0, S.smokeSettings.Size.Start);
  5311. NumberSequenceKeypoint.new(1, S.smokeSettings.Size.End);
  5312. }
  5313. )
  5314. Particles.Texture = S.smokeSettings.Texture
  5315. Particles.Transparency = NumberSequence.new(
  5316. {
  5317. NumberSequenceKeypoint.new(0, S.smokeSettings.startTransparency);
  5318. NumberSequenceKeypoint.new(0.5, 0.75 * S.smokeSettings.startTransparency + 0.25);
  5319. NumberSequenceKeypoint.new(1, 1);
  5320. }
  5321. )
  5322. Particles.Acceleration = V3(0, -196.2, 0)
  5323. Particles.EmissionDirection = Enum.NormalId.Front
  5324. Particles.Lifetime = NumberRange.new(S.smokeSettings.Lifetime - 0.05, S.smokeSettings.Lifetime + 0.05)
  5325. Particles.Rate = S.smokeSettings.Rate
  5326. Particles.Rotation = NumberRange.new(0, 360)
  5327. Particles.RotSpeed = NumberRange.new(10)
  5328. Particles.Speed = NumberRange.new(S.smokeSettings.Speed - 5, S.smokeSettings.Speed + 5)
  5329. Particles.VelocitySpread = S.smokeSettings.Spread
  5330. Particles.Parent = Smoke
  5331.  
  5332. Smoke.Parent = gunIgnore
  5333. Smoke.CFrame = surfaceCF
  5334. if (not H.Anchored) then
  5335. local Weld = Instance.new("Weld", Smoke)
  5336. Weld.Part0 = H
  5337. Weld.Part1 = Smoke
  5338. Weld.C0 = H.CFrame:toObjectSpace(surfaceCF)
  5339. Smoke.Anchored = false
  5340. end
  5341. delay(0.1, function()
  5342. Particles.Enabled = false
  5343. wait(S.smokeSettings.Lifetime + 0.05)
  5344. Smoke:Destroy()
  5345. end)
  5346. end
  5347. end)
  5348.  
  5349. ----------------------------------------------------------------------
  5350. --------------------[ SHOCKWAVE HANDLING ]----------------------------
  5351. ----------------------------------------------------------------------
  5352.  
  5353. local createShockwave = script:WaitForChild("createShockwave")
  5354. createShockwave.OnServerEvent:connect(function(_, Center, Radius, gunIgnore, S)
  5355. local Shockwave = Instance.new("Part")
  5356. Shockwave.BrickColor = S.shockwaveSettings.Color
  5357. Shockwave.Material = Enum.Material.SmoothPlastic
  5358. Shockwave.Name = "Shockwave"
  5359. Shockwave.Anchored = true
  5360. Shockwave.CanCollide = false
  5361. Shockwave.FormFactor = Enum.FormFactor.Symmetric
  5362. Shockwave.Size = V3(1, 1, 1)
  5363. Shockwave.BottomSurface = Enum.SurfaceType.Smooth
  5364. Shockwave.TopSurface = Enum.SurfaceType.Smooth
  5365. local Mesh = Instance.new("SpecialMesh")
  5366. Mesh.MeshType = Enum.MeshType.Sphere
  5367. Mesh.Scale = V3()
  5368. Mesh.Parent = Shockwave
  5369. Shockwave.Parent = gunIgnore
  5370. Shockwave.CFrame = CF(Center)
  5371. spawn(function()
  5372. local t0 = tick()
  5373. while true do
  5374. local Alpha = math.min((tick() - t0) / S.shockwaveSettings.Duration, 1)
  5375. local Scale = 2 * Radius * Alpha
  5376. Mesh.Scale = V3(Scale, Scale, Scale)
  5377. Shockwave.Transparency = Alpha
  5378. if Alpha == 1 then break end
  5379. wait()
  5380. end
  5381. Shockwave:Destroy()
  5382. end)
  5383. end)
  5384.  
  5385. ----------------------------------------------------------------------
  5386. --------------------[ BLOOD HANDLING ]--------------------------------
  5387. ----------------------------------------------------------------------
  5388.  
  5389. local createBlood = script:WaitForChild("createBlood")
  5390. createBlood.OnServerEvent:connect(function(_, H, P, D, gunIgnore, S)
  5391. local bloodCF = CF(P, P + D) * CFANG(RAD(-90), 0, 0)
  5392. local Blood = Instance.new("Part")
  5393. Blood.Transparency = 1
  5394. Blood.Anchored = true
  5395. Blood.CanCollide = false
  5396. Blood.FormFactor = "Custom"
  5397. Blood.Size = V3(0.2, 1, 0.2)
  5398. Blood.TopSurface = 0
  5399. Blood.BottomSurface = 0
  5400.  
  5401. local Particles = Instance.new("ParticleEmitter")
  5402. Particles.Color = ColorSequence.new(S.bloodSettings.Color)
  5403. Particles.LightEmission = 0
  5404. Particles.Size = NumberSequence.new(S.bloodSettings.Size)
  5405. Particles.Texture = S.bloodSettings.Texture
  5406. Particles.Transparency = NumberSequence.new(
  5407. {
  5408. NumberSequenceKeypoint.new(0, S.bloodSettings.startTransparency);
  5409. NumberSequenceKeypoint.new(1, 1);
  5410. }
  5411. )
  5412. Particles.EmissionDirection = Enum.NormalId.Top
  5413. Particles.Lifetime = NumberRange.new(S.bloodSettings.Lifetime - 0.05, S.bloodSettings.Lifetime + 0.05)
  5414. Particles.Rate = S.bloodSettings.Rate
  5415. Particles.Rotation = NumberRange.new(0, 90)
  5416. Particles.Speed = NumberRange.new(S.bloodSettings.Speed)
  5417. Particles.VelocitySpread = S.bloodSettings.Spread
  5418. Particles.Parent = Blood
  5419.  
  5420. Blood.Parent = gunIgnore
  5421. Blood.CFrame = bloodCF
  5422. if (not H.Anchored) then
  5423. local Weld = Instance.new("Weld", Blood)
  5424. Weld.Part0 = H
  5425. Weld.Part1 = Blood
  5426. Weld.C0 = H.CFrame:toObjectSpace(bloodCF)
  5427. Blood.Anchored = false
  5428. end
  5429. delay(0.15, function()
  5430. Particles.Enabled = false
  5431. wait(S.bloodSettings.Lifetime + 0.05)
  5432. Blood:Destroy()
  5433. end)
  5434. end)
  5435.  
  5436. ----------------------------------------------------------------------
  5437. --------------------[ TRAIL HANDLING ]--------------------------------
  5438. ----------------------------------------------------------------------
  5439.  
  5440. local createTrail = script:WaitForChild("createTrail")
  5441. createTrail.OnServerEvent:connect(function(_, Origin, P, gunIgnore, S)
  5442. local Trail = Instance.new("Part")
  5443. Trail.BrickColor = S.trailSettings.Color
  5444. Trail.Transparency = S.trailSettings.Transparency
  5445. Trail.Anchored = true
  5446. Trail.CanCollide = false
  5447. Trail.Size = V3(1, 1, 1)
  5448. local Mesh = Instance.new("CylinderMesh")
  5449. Mesh.Offset = V3(0, -(P - Origin).magnitude / 2, 0)
  5450. Mesh.Scale = V3(S.trailSettings.Thickness, (P - Origin).magnitude, S.trailSettings.Thickness)
  5451. Mesh.Parent = Trail
  5452. Trail.Parent = gunIgnore
  5453. Trail.CFrame = CF(Origin, P) * CFANG(RAD(90), 0, 0)
  5454. delay(S.trailSettings.visibleTime, function()
  5455. if S.trailSettings.disappearTime > 0 then
  5456. local t0 = tick()
  5457. while true do
  5458. local Alpha = math.min((tick() - t0) / S.trailSettings.disappearTime, 1)
  5459. Trail.Transparency = numLerp(S.trailSettings.Transparency, 1, Alpha)
  5460. if Alpha == 1 then break end
  5461. wait()
  5462. end
  5463. Trail:Destroy()
  5464. else
  5465. Trail:Destroy()
  5466. end
  5467. end)
  5468. end)
  5469. end,o128)
  5470. end))
  5471. o129.Name = "Plyr"
  5472. o129.Parent = o128
  5473. o130.Name = "getWeldCF"
  5474. o130.Parent = o128
  5475. o131.Name = "gunSetup"
  5476. o131.Parent = o128
  5477. o132.Name = "tweenJoint"
  5478. o132.Parent = o128
  5479. o133.Name = "onRenderStep"
  5480. o133.Parent = o128
  5481. o134.Name = "createTweenIndicator"
  5482. o134.Parent = o128
  5483. o135.Name = "deleteTweenIndicator"
  5484. o135.Parent = o128
  5485. o136.Name = "lerpCF"
  5486. o136.Parent = o128
  5487. o137.Name = "resetCam"
  5488. o137.Parent = o128
  5489. table.insert(cors,coroutine.create(function()
  5490. wait()
  5491. runDummyScript(function()
  5492. repeat wait() until game.Players.LocalPlayer.Character
  5493.  
  5494. local Player = game.Players.LocalPlayer
  5495. local Char = Player.Character
  5496. local Humanoid = Char:WaitForChild("Humanoid")
  5497.  
  5498. local Cam = game.Workspace.CurrentCamera
  5499. local UIS = game:GetService("UserInputService")
  5500.  
  5501. local ignoreCode = script:WaitForChild("ignoreCode")
  5502. repeat wait() until ignoreCode.Value ~= 0
  5503. local ignoreModel = game.Workspace:WaitForChild("ignoreModel_"..ignoreCode.Value)
  5504. local gunIgnore = ignoreModel:FindFirstChild("gunIgnore_"..Player.Name)
  5505.  
  5506. Cam.FieldOfView = 70
  5507. Cam.CameraType = Enum.CameraType.Custom
  5508. Cam:ClearAllChildren()
  5509.  
  5510. UIS.MouseBehavior = Enum.MouseBehavior.Default
  5511. UIS.MouseIconEnabled = true
  5512.  
  5513. Player.CameraMode = Enum.CameraMode.Classic
  5514.  
  5515. Humanoid.WalkSpeed = 16
  5516. Humanoid.AutoRotate = true
  5517.  
  5518. if gunIgnore then gunIgnore:Destroy() end
  5519. end,o137)
  5520. end))
  5521. o138.Name = "ignoreCode"
  5522. o138.Parent = o137
  5523. o139.Name = "createBulletImpact"
  5524. o139.Parent = o128
  5525. o140.Name = "createShockwave"
  5526. o140.Parent = o128
  5527. o141.Name = "createBlood"
  5528. o141.Parent = o128
  5529. o142.Name = "createTrail"
  5530. o142.Parent = o128
  5531. o146.Name = "Main"
  5532. o146.Parent = o9
  5533. o146.BrickColor = BrickColor.new("Really black")
  5534. o146.Transparency = 1
  5535. o146.Position = Vector3.new(-142.811111, 3.77665901, 35.4919434)
  5536. o146.Rotation = Vector3.new(90, 0, -180)
  5537. o146.Anchored = true
  5538. o146.CanCollide = false
  5539. o146.FormFactor = Enum.FormFactor.Custom
  5540. o146.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
  5541. o146.CFrame = CFrame.new(-142.811111, 3.77665901, 35.4919434, -1, 6.64065794e-07, -1.37817087e-05, 1.37817087e-05, -8.88257783e-12, -1, -6.64065794e-07, -1, -2.69383799e-13)
  5542. o146.BottomSurface = Enum.SurfaceType.Smooth
  5543. o146.TopSurface = Enum.SurfaceType.Smooth
  5544. o146.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  5545. o146.Position = Vector3.new(-142.811111, 3.77665901, 35.4919434)
  5546. o146.Orientation = Vector3.new(90, 180, 0)
  5547. o146.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  5548. o147.Name = "1FlashFX[Smoke]"
  5549. o147.Parent = o146
  5550. o147.Transparency = NumberSequence.new(0.60000002384186,1)
  5551. o147.Rotation = NumberRange.new(0,360)
  5552. o147.Size = NumberSequence.new(0.99999964237213,3)
  5553. o147.Color = ColorSequence.new(Color3.new(0.27451, 0.27451, 0.27451),Color3.new(0.27451, 0.27451, 0.27451))
  5554. o147.Enabled = false
  5555. o147.LightEmission = 0.10000000149012
  5556. o147.Texture = "http://www.roblox.com/asset/?id=244514423"
  5557. o147.Lifetime = NumberRange.new(1.25,1.5)
  5558. o147.Rate = 100
  5559. o147.RotSpeed = NumberRange.new(10,10)
  5560. o147.Speed = NumberRange.new(5,7)
  5561. o147.VelocitySpread = 15
  5562. o147.Color = ColorSequence.new(Color3.new(0.27451, 0.27451, 0.27451),Color3.new(0.27451, 0.27451, 0.27451))
  5563. o148.Name = "FlashFX[Flash]"
  5564. o148.Parent = o146
  5565. o148.Transparency = NumberSequence.new(0.75,1)
  5566. o148.Rotation = NumberRange.new(0,90)
  5567. o148.Size = NumberSequence.new(0.5,0)
  5568. o148.Color = ColorSequence.new(Color3.new(1, 1, 0.498039),Color3.new(1, 1, 0.498039))
  5569. o148.Enabled = false
  5570. o148.LightEmission = 1
  5571. o148.Texture = "http://www.roblox.com/asset/?id=3419963"
  5572. o148.Lifetime = NumberRange.new(0.050000000745058,0.075000002980232)
  5573. o148.Rate = 1000
  5574. o148.Speed = NumberRange.new(50,50)
  5575. o148.Color = ColorSequence.new(Color3.new(1, 1, 0.498039),Color3.new(1, 1, 0.498039))
  5576. o149.Name = "FlashFX[Light]"
  5577. o149.Parent = o146
  5578. o149.Color = Color3.new(1, 1, 0.498039)
  5579. o149.Enabled = false
  5580. o149.Brightness = 10
  5581. o149.Range = 6
  5582. o149.Shadows = true
  5583. o149.Color = Color3.new(1, 1, 0.498039)
  5584. mas.Parent = workspace
  5585. mas:MakeJoints()
  5586. local mas1 = mas:GetChildren()
  5587. for i=1,#mas1 do
  5588. mas1[i].Parent = workspace
  5589. ypcall(function() mas1[i]:MakeJoints() end)
  5590. end
  5591. mas:Destroy()
  5592. for i=1,#cors do
  5593. coroutine.resume(cors[i])
  5594. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement