Advertisement
Animescapetower

Gun Tool Testing

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