Advertisement
OofNoob

broken

Mar 17th, 2018
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 127.20 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5. wait(0.2)
  6.  
  7.  
  8. --wait(1)
  9. --dylaname = game.Players.LocalPlayer.Name
  10.  
  11. --game.Workspace:WaitForChild(dylaname)
  12.  
  13. dylan = game.Players.LocalPlayer
  14.  
  15. dylan.Character.Name = "Dylan Klebold"
  16.  
  17. if dylan.Character:FindFirstChild("Shirt") then dylan.Character.Shirt:Destroy()
  18. end
  19. if dylan.Character:FindFirstChild("Pants") then dylan.Character.Pants:Destroy()
  20. end
  21. if dylan.Character:FindFirstChild("Shirt Graphic") then dylan.Character["Shirt Graphic"]:Destroy()
  22. end
  23.  
  24. if not dylan.Character:FindFirstChild("Shirt") then
  25. NewShirt = Instance.new("Shirt", dylan.Character)
  26. NewShirt.Name = "Shirt"
  27. end
  28.  
  29.  
  30. if not dylan.Character:FindFirstChild("Pants") then
  31. NewPants = Instance.new("Pants", dylan.Character)
  32. NewPants.Name = "Pants"
  33. end
  34.  
  35. for _, v in pairs(dylan.Character:GetChildren()) do
  36. if v:IsA("Accessory") then
  37. v:Destroy()
  38. end
  39. end
  40.  
  41. for _, v in pairs(dylan.Character:GetChildren()) do
  42. if v:IsA("CharacterMesh") then
  43. v:Destroy()
  44. end
  45. end
  46.  
  47.  
  48. game:GetObjects("rbxassetid://732911005")[1].Parent=game.Players.LocalPlayer.Character
  49. game:GetObjects("rbxassetid://732944580")[1].Parent=game.Players.LocalPlayer.Character
  50. wait(0.1)
  51. dylan.Character.Dylancap.Handle.Transparency = 0
  52. dylan.Character["Shirt"].ShirtTemplate = "http://www.roblox.com/asset/?id=679814237"
  53. dylan.Character["Pants"].PantsTemplate = "http://www.roblox.com/asset/?id=710750764"
  54.  
  55.  
  56.  
  57. game:GetObjects("rbxassetid://0")[1].Parent=game.Players.LocalPlayer.Backpack
  58.  
  59. pumpk = Instance.new("Sound")
  60. pumpk.Parent = game.Players.LocalPlayer.Character.Head
  61. pumpk.SoundId = "rbxassetid://488429159"
  62. pumpk.Volume = 3
  63.  
  64. pumpk:Play()
  65. pumpk.Looped = true
  66.  
  67.  
  68.  
  69. wait(0.2)
  70.  
  71. repeat wait() until game.Players.LocalPlayer.Character
  72. repeat wait() until game.Players.LocalPlayer.Character:IsDescendantOf(game.Workspace)
  73. wait(1 / 20)
  74.  
  75. --------------------------------------------------------------------------------------
  76. --------------------[ IGNORE MODEL ]--------------------------------------------------
  77. --------------------------------------------------------------------------------------
  78.  
  79. local Ignore_Code = game.Players.LocalPlayer.Backpack["TEC-9"].Ignore_Code or game.Players.LocalPlayer.Character["TEC-9"].Ignore_Code
  80. Ignore_Code.Value = game.Players.LocalPlayer.UserId
  81.  
  82.  
  83. local Ignore_Model = Instance.new("Model")
  84. Ignore_Model.Name = "Ignore_Model_"..Ignore_Code.Value
  85. Ignore_Model.Parent = game.Workspace
  86.  
  87.  
  88.  
  89. --------------------------------------------------------------------------------------
  90. --------------------[ CONSTANTS ]-----------------------------------------------------
  91. --------------------------------------------------------------------------------------
  92.  
  93. local Gun = game.Players.LocalPlayer.Backpack["TEC-9"] or game.Players.LocalPlayer.Character["TEC-9"]
  94. local Handle = Gun:WaitForChild("Handle")
  95. local AimPart = Gun:WaitForChild("AimPart")
  96. local Main = Gun:WaitForChild("Main")
  97.  
  98. local Ammo = Gun:WaitForChild("Ammo")
  99. local ClipSize = Gun:WaitForChild("ClipSize")
  100. local StoredAmmo = Gun:WaitForChild("StoredAmmo")
  101.  
  102. local LethalGrenades = Gun:WaitForChild("LethalGrenades")
  103. local TacticalGrenades = Gun:WaitForChild("TacticalGrenades")
  104.  
  105. local Settings = { --These are the settings, change them however you like
  106.  
  107.  
  108. GunName = "TEC-9"; --This is the name that will be displayed on the Tool
  109. Description = "Task Force 88's secondary capper."; --This will be the text that is displayed above the tool when the mouse is hovering over it
  110.  
  111.  
  112. GunType = { --[[These are the 5 gun types you can have. Set whichever ones you want to true. (NOTE: Semi and Auto can't both be
  113. true, and Burst and Auto can't both be true)]]
  114. Semi = false; --Set this true if you want the gun to be semi-automatic. (Pistols, Snipers, etc)
  115. Auto = true; --Set this true if you want the gun to be fully automatic. (Assault Rifles, Submachine guns, machine guns, etc)
  116. Burst = false; --Set this true if you want the gun to be burst fire. (Battle rifles, assault rifles, etc)
  117. Shot = false; --Set this true if you want the gun to be a shotgun. (NOTE: Shot and auto can both be true)
  118. Explosive = false; --Set this true if you want the projectiles to be explosive. (Rocket launchers, grenade launchers, etc)
  119. };
  120.  
  121.  
  122. BurstAmount = 3; --This is how many bullets will be fired in one burst (if Burst is true)
  123. BurstTime = 0.2; --This is how long it takes for a burst to complete
  124. BurstWait = 0.1; --This is how much time you have to wait before you can fire another burst
  125.  
  126.  
  127. ShotAmount = 5; --This is how many bullets will be fired in one shot (if Shot is true)
  128.  
  129.  
  130. ExplosionRadius = 35; --This is the radius of the explosion when the bullet hits a target. (If Explosive is true)
  131. ExplosionPressure = 5e5; --This is the pressure of the explosion when the bullet hits the target
  132. ExplosionType = 0; --This is the type of explosion
  133. --[[
  134. (0 or "NoCraters" or Enum.ExplosionType.NoCraters) means that the explosion will not damage terrain
  135. (1 or "Craters" or Enum.ExplosionType.Craters) means that the explosion will leave craters in terrain
  136. (2 or "CratersAndDebris" or Enum.ExplosionType.CratersAndDebris) means that the explosion will leave craters and debris in terrain
  137. --]]
  138. ExplosionSound = "http://roblox.com/asset/?id=142070127"; --This is what the sound of the explosion will be
  139. ExplosionSoundPitch = 1; --This is what the pitch of the explosion sound will be
  140. ExplosionSoundVolume = 1; --This is what the volume of the explosion sound will be
  141. RayCastExplosions = false; --[[This is whether or not explosions will have raycasting. If this is true, humanoids behind walls
  142. won't be damaged. If this is false, any humanoid within the radius will be damaged. (NOTE: RangeBasedDamage has to be true in
  143. order for explosions to have raycasting)]]
  144. RangeBasedDamage = true; --[[This is whether or not will depend on how far the object is from the center of the explosion. If this
  145. is true, the farther a humanoid is from the blast center, the less damage it'll take. If this is false, any object within
  146. the explosion's radius will have its joints broken]]
  147.  
  148.  
  149. PlayerArms = true; --This is whether or not the fake arms will look like the Player's arms
  150. FakeArmTransparency = 0; --This is the transparency of the fake arms
  151. FakeArmRealBodyColor = true; --This is whether or not the color of the fake arm will be the color of the player's real arms
  152. FakeArmColor = BrickColor.new("Pastel brown"); --This is what the color of the fake arms will be if FakeArmRealBodyColor is false
  153.  
  154. ArmC1_UnAimed = { --This table contains the CFrames of the arms when the gun is not aimed
  155. Left = CFrame.new(0.1, 1.85, -0.3) * CFrame.Angles(0, 0, math.rad(-50)); --This is the cframe of the left arm
  156. Right = CFrame.new(0.4, 0.25, 0) * CFrame.Angles(0, 0, math.rad(25)); --This is the cframe of the right arm
  157. };
  158.  
  159. ArmC1_Aimed = { --This table contains the CFrames of the arms when the gun is aimed
  160. Left = CFrame.new(-1.15, 0.35, 0.05) * CFrame.Angles(0, 0, math.rad(-20)); --This is the cframe of the left arm
  161. Right = CFrame.new(1.1, 0.35, 0.1) * CFrame.Angles(0, 0, math.rad(20)); --This is the cframe of the right arm
  162. };
  163.  
  164.  
  165. PlayerAnimations = true; --This is whether or not the player will have custom animations
  166. AimAnimation = true; --This is whether or not there is an animation for aiming down the sights
  167. ReloadAnimation = true; --This is whether or not there is an animation for reloading
  168. StanceAnimation = true; --This is whether or not there is an animation for changing stance
  169.  
  170.  
  171. AimSpeed = 0.15; --This is how long the gun will take to fully aim down the sights
  172. MaxZoom = 90; --This is the FOV that the Camera will have when the gun is fully aimed down
  173. HoldMouseOrKeyToADS = true; --This is whether or not you have to hold the right mouse or the ADS key to ADS
  174.  
  175.  
  176. GuiScope = false; --This is whether or not your Scope will be a gui instead of a normal sight
  177. GuiId = "http://www.roblox.com/asset/?id=160682367"; --This is the ImageId of the GuiScope
  178. ScopeSway = 2; --This is the sway, in radians, of the camera
  179.  
  180.  
  181. ScopeSteadyTime = 8; --This is how long you can hold your breath to steady the scope
  182. SteadyCooldownTime = 4; --This is how long it takes to fully retake your breath
  183. UnSteadyOnFire = true; --This is whether or not the camera will become unsteady when you fire the gun
  184.  
  185.  
  186. FireRate = 900; --This is how many bullets per minute the gun will fire
  187. BulletRange = 2000; --This is how far the bullet will travel before it is no longer effective
  188.  
  189.  
  190. InstantHit = false; --[[This is whether or not the bullet will hit a target instantly. If it is false, the bullet will travel at a
  191. specific speed till it hits a target]]
  192. BulletVelocity = 2400; --This is how fast the bullet will travel in studs per second
  193.  
  194.  
  195. Damage = 22; --This is the base damage. That means that this is the least amount of damage that will be inflicted
  196. Multipliers = { --[[These are the damage multipliers. There's a spread of +0.1. That means that if the multiplier is 1, the actual
  197. multiplier will range from 1 - 1.1]]
  198. Chest = 1; --This is what the damage will be multiplied by if the bullet hits the chest
  199. Head = 1.5; --This is what the damage will be multiplied by if the bullet hits the head or a hat
  200. Limbs = 0.7; --This is what the damage will be multiplied by if the bullet hits a limb (Arms or legs)
  201. };
  202.  
  203.  
  204. AllowFriendlyFire = false; --This is whether or not you can damage teammates
  205. CanDamageNPCs = true; --This is whether or not you can damage NPC's (Zombies, fake players, anything with a humanoid)
  206.  
  207.  
  208. RotateWhileSitting = true; --This is whether or not your player will rotate when you are sitting down
  209.  
  210.  
  211. CanKnife = true; --This is whether or not you can knife
  212. KnifeMeshId = "http://www.roblox.com/asset/?id=121944778"; --This is the Mesh of the knife
  213. KnifeTextureId = "http://www.roblox.com/asset/?id=121944805"; --This is the Texture of the knife
  214. KnifeCooldown = 0.75; --This is how long you have to wait before you can knife again
  215.  
  216.  
  217. Throwables = true; --This is whether or not you have grenades
  218. TrajectoryAssist = false; --This is whether or not the script will show you the flight path of the grenade before you throw it
  219. DetonationTime = 1; --[[This is how long the grenade will wait to detonate (If DetonateOnHit is false, this is how long the
  220. grenade will wait after it's thrown. If DetonateOnHit is true, this is how long the grenade will wait after it hits something]]
  221. TimerStartOnHit = true; --This is whether or not the timer will start when the grenade hits something
  222. GrenadeColor = BrickColor.new("Black"); --This is the color of the grenade
  223. GrenadeSize = Vector3.new(0.8, 0.8, 0.8); --This is the size of the grenade (Doesn't apply to throwing knives)
  224.  
  225.  
  226. GrenadeBlastRadius = 10; --This is the blast radius of the explosion (Doesn't apply to non-explosive grenades)
  227. GrenadeBlastPressure = 5e5; --This is what the blast pressure of the explosion (Doesn't apply to non-explosive grenades)
  228. GrenadeExplosionType = Enum.ExplosionType.NoCraters; --This is the type of explosion (Doesn't apply to non-explosive grenades)
  229. --[[
  230. (0 or "NoCraters" or Enum.ExplosionType.NoCraters) means that the explosion will not damage terrain
  231. (1 or "Craters" or Enum.ExplosionType.Craters) means that the explosion will leave craters in terrain
  232. (2 or "CratersAndDebris" or Enum.ExplosionType.CratersAndDebris) means that the explosion will leave craters and debris in terrain
  233. --]]
  234. LethalGrenadeDamage = 100; --This is max damage that the grenade will do
  235. LethalGrenadeThrowVelocity = 170; --This is the speed at which the lethal grenade is thrown
  236. GrenadeRayCastExplosions = true; --[[This is whether or not grenade explosions will have raycasting. If this is true, humanoids
  237. behind walls won't be damaged. If this is false, any humanoid within the radius will be damaged. (NOTE: GrenadeRangeBasedDamage
  238. has to be true in order for explosions to have raycasting)]]
  239. GrenadeRangeBasedDamage = true; --[[This is whether or not will depend on how far the object is from the center of the explosion.
  240. If this is true, the farther a humanoid is from the blast center, the less damage it'll take. If this is false, any object
  241. within the explosion's radius will have its joints broken]]
  242. LethalGrenadeType = 1; --This is the lethal grenade type
  243. --[[
  244. Type 1: Frag grenade [An explosive grenade]
  245. Type 2: Sticky [An explosive grenade that sticks to a surface]
  246. Type 3: Throwing Knife [A throwable knife]
  247. --]]
  248.  
  249. TacticalGrenadeThrowVelocity = 200; --This is the speed at which the tactical grenade is thrown
  250. GrenadeEffectRadius = 50; --[[This is the radius of the effect of the grenade. If the Grenade is a smoke, this is the radius of
  251. the smoke]]
  252. GrenadeEffectTime = 12; --[[This is the how long the grenade effect will last. If the grenade is a smoke, this is how long the
  253. smoke will linger]]
  254. TacticalGrenadeType = 1; --This is the tactical grenade type
  255. --[[
  256. Type 1: Smoke grenade [A grenade that creates a cloud of smoke]
  257. --]]
  258.  
  259.  
  260. GrenadeTrail = false; --This is whether or not the grenade will have a trail
  261. GrenadeTrailColor = BrickColor.new("Black"); --This is the color of the grenade trail
  262. GrenadeTrailTransparency = 0.95; --This is the transparency of the trail
  263. GrenadeTrailThickness = 0.2; --This is the thickness of the trail
  264. GrenadeTrailVisibleTime = 0.05; --This is how long the trail will be visible for
  265. GrenadeTrailDisappearTime = 0.1; --This is how long it will take for the trail to disappear
  266.  
  267.  
  268. BulletColor = BrickColor.new("Bright yellow"); --This is the color of the bullet
  269. BulletTransparency = 1; --This is the transparency of the bullet
  270. BulletSize = Vector3.new(0, 0, 0); --This is the actual size of the bullet
  271. BulletMeshSize = Vector3.new(0, 0, 0); --This is the mesh size of the bullet.
  272. --BulletSize * BulletMeshSize = How big the bullet looks
  273.  
  274.  
  275. BulletTrail = false; --This is whether or not there will be a trail behind the bullet
  276. TrailColor = BrickColor.new("Dark stone grey"); --This is the color of the bullet trail
  277. TrailTransparency = 0.8; --This is the transparency of the trail
  278. TrailThickness = 0.01; --This is the thickness of the trail
  279. TrailVisibleTime = 0.01; --This is how long the trail will be visible for
  280. TrailDisappearTime = 0.01; --This is how long it will take for the trail to disappear
  281.  
  282.  
  283. BulletHoles = true; --This is whether or not bullet holes will appear where you shot
  284. BulletHoleTexture = "http://www.roblox.com/asset/?id=64291961"; --This is the texture of the bullet hole
  285. BulletHoleSize = 0.5; --This is how big the bullet hole will be in studs
  286. BulletHoleVisibleTime = 3; --This is how long the bullet hole will be visible for
  287. BulletHoleDisappearTime = 1; --This is how long it will take for the bullet hole to disappear
  288.  
  289.  
  290. Shockwaves = true; --This is whether or not a shockwave will appear where you shot. (A sphere that appears when the bullet hits)
  291. ShockwaveRadius = 0.3; --This is the radius of the shockwave. (If the gun type is explosion, this radius will be the blast radius)
  292. ShockwaveColor = BrickColor.new("Light stone grey"); --This is the color of the shockwave
  293. ShockwaveDuration = 0.2; --This is how long the shockwave will take to disappear
  294.  
  295.  
  296. Penetration = 0; --[[This is how many studs a bullet can penetrate into a wall. So if penetration is 2 and the wall is 3 studs
  297. thick, the bullet won't come out the other side]]
  298.  
  299.  
  300. BulletDropPerSecond = 0; --This is the bullet's acceleration downward per second (196.2 is normal roblox gravity)
  301.  
  302.  
  303. Recoil = {
  304. Aimed = 0.3; --This is the recoil the gun will have when the gun is aimed down
  305. Hipfire = 1.2; --This is the recoil the gun will have when the gun is fired from the hip
  306. };
  307. Spread = { --[[This spread values are how many degrees offset / 20 the bullets from the center the bullets will travel. So a spread
  308. of 20 would mean that the bullet's max spread in any direction is 1 degree from the center]]
  309. Aimed = 0; --This is the spread when the gun is aimed down. it isn't affected by the multiplier.
  310. Hipfire = 20; --This is the base spread when the gun is fired from the hip
  311. Max = 40; --This is the highest the spread can be when fired
  312. Multiplier = 1.1; --This is how much the spread will be multiplied by when fired. It only affects the Hipfire spread
  313. Walking = 30; --This is the spread while walking. It isn't affected by the multiplier
  314. };
  315.  
  316.  
  317. ReloadTime = 1.3; --This is how long it takes to reload the gun
  318. AutoReload = true; --This is whether or not the gun will reload automatically when the ammo reaches 0
  319.  
  320.  
  321. SprintTime = 15; --This is the maximum time you can sprint
  322. StaminaCoolTime = 3; --This is how long it takes for your stamina to fully recharge
  323.  
  324.  
  325. DolphinDive = false; --This is whether or not you can dolphin dive (Run and crouch at the same time to dive)
  326. DiveRechargeTime = 1; --This is how long you have to wait till you can dive or run again after you've dived
  327.  
  328.  
  329. CanChangeStance = true; --This is whether or not you can change stance. That means whether or not you can crouch or go prone
  330. StanceChangeSpeed = 0.3; --This is how quickly you change stance
  331. StandOnDeselect = true; --This is whether or not you stand up when you deselect the tool
  332.  
  333.  
  334. BaseWalkSpeed = 18; --This is the base walkspeed
  335. SprintSpeed = 32; --This is the walkspeed when you're sprinting
  336. AimedWalkSpeed = 12; --[[This is the base walkspeed when the gun is aimed down. If you crouch or go prone, the speed will change
  337. based on the AimedWalkSpeed to BaseWalkSpeed ratio]]
  338. CrouchWalkSpeed = 8; --This is the walkspeed when you're crouched
  339. ProneWalkSpeed = 6; --This is the walkspeed when you're prone
  340.  
  341.  
  342. --NOTE: For extra keys, go here: http://wiki.roblox.com/index.php?title=Taking_keyboard_input
  343. LowerStanceKey = "c"; --This is the key you press to lower your stance (Stand > Crouch > Prone)
  344. RaiseStanceKey = "x"; --This is the key you press to raise your stance (Prone > Crouch > Stand)
  345. SwitchFireKey = "v"; --This is the key you press to switch fire modes
  346. ReloadKey = "r"; --This is the key you press to reload
  347. SprintKey = string.char(48); --This is the key you press to sprint
  348. KnifeKey = "f"; --This is the key you press to knife
  349. LethalGrenadeKey = "g"; --This is the key you press to throw the lethal grenade
  350. TacticalGrenadeKey = "t"; --This is the key you press to throw the tactical grenade
  351. ADSKey = "q"; --This is the key you press to ADS. If you want ADS to just be right mouse, then make this key ""
  352. ScopeSteadyKey = string.char(48); --This is the key you press to steady the scope (shift)
  353.  
  354.  
  355. }
  356.  
  357. local S = Settings
  358.  
  359. local Player = game.Players.LocalPlayer
  360. local Character = Player.Character
  361. local Humanoid = Character:WaitForChild("Humanoid")
  362. local Torso = Character:WaitForChild("Torso")
  363. local Head = Character:WaitForChild("Head")
  364. local HRP = Character:WaitForChild("HumanoidRootPart")
  365.  
  366. local Neck = Torso:WaitForChild("Neck")
  367.  
  368. local LArm = Character:WaitForChild("Left Arm")
  369. local RArm = Character:WaitForChild("Right Arm")
  370. local LLeg = Character:WaitForChild("Left Leg")
  371. local RLeg = Character:WaitForChild("Right Leg")
  372.  
  373. local M2 = Player:GetMouse()
  374. local Main_Gui = Gun.Main_Gui
  375.  
  376. local RS = game:GetService("RunService").RenderStepped
  377.  
  378. local Camera = game.Workspace.CurrentCamera
  379.  
  380. local ABS, HUGE, FLOOR, CEIL = math.abs, math.huge, math.floor, math.ceil
  381. local RAD, SIN, ATAN, COS = math.rad, math.sin, math.atan2, math.cos
  382. local VEC3 = Vector3.new
  383. local CF, CFANG = CFrame.new, CFrame.Angles
  384. local INSERT = table.insert
  385.  
  386. local MaxStamina = S.SprintTime * 60
  387. local MaxSteadyTime = S.ScopeSteadyTime * 60
  388.  
  389. local LethalIcons = {
  390. "http://www.roblox.com/asset/?id=194849880";
  391. "http://www.roblox.com/asset/?id=195727791";
  392. "http://www.roblox.com/asset/?id=195728137";
  393. }
  394.  
  395. local TacticalIcons = {
  396. "http://www.roblox.com/asset/?id=195728473";
  397. "http://www.roblox.com/asset/?id=195728693";
  398. }
  399.  
  400. local Ignore = {
  401. Character;
  402. Ignore_Model;
  403. }
  404.  
  405. local StanceOffset = {
  406. VEC3(0, 0, 0);
  407. VEC3(0, -1, 0);
  408. VEC3(0, -3, 0);
  409. }
  410.  
  411. local Shoulders = {
  412. Right = Torso:WaitForChild("Right Shoulder");
  413. Left = Torso:WaitForChild("Left Shoulder")
  414. }
  415.  
  416. local ArmC0 = {
  417. CF(-1.5, 0, 0) * CFANG(RAD(90), 0, 0);
  418. CF(1.5, 0, 0) * CFANG(RAD(90), 0, 0);
  419. }
  420.  
  421. local Sine = function(X)
  422. return SIN(RAD(X))
  423. end
  424.  
  425. local Linear = function(X)
  426. return (X / 90)
  427. end
  428.  
  429. --------------------------------------------------------------------------------------
  430. --------------------[ VARIABLES ]-----------------------------------------------------
  431. --------------------------------------------------------------------------------------
  432.  
  433. local Selected = false
  434.  
  435. local Idleing = false
  436. local Walking = false
  437. local Running = false
  438.  
  439. local Aimed = false
  440. local Aiming = false
  441.  
  442. local Reloading = false
  443. local BreakReload = false
  444.  
  445. local Knifing = false
  446. local ThrowingGrenade = false
  447.  
  448. local MB1_Down = false
  449.  
  450. local CanFire = true
  451.  
  452. local KnifeReady = true
  453.  
  454. local CanRun = true
  455. local RunTween = false
  456. local Run_Key_Pressed = false
  457. local ChargingStamina = false
  458.  
  459. local AimingIn = false
  460. local AimingOut = false
  461.  
  462. local Stamina = S.SprintTime * 60
  463. local CurrentSteadyTime = S.ScopeSteadyTime * 60
  464.  
  465. local CameraSteady = false
  466. local TakingBreath = false
  467.  
  468. local Grip = nil
  469. local Aimed_GripCF = nil
  470.  
  471. local Gui_Clone = nil
  472.  
  473. local CurrentSpread = S.Spread.Hipfire
  474. local CurrentRecoil = S.Recoil.Hipfire
  475.  
  476. local AmmoInClip = 0
  477.  
  478. local Stance = 0
  479. local StanceSway = 1
  480. local CameraSway = 1
  481.  
  482. local HeadRot = 0
  483. local ArmTilt = 0
  484.  
  485. local LastBeat = 0
  486.  
  487. local Parts = {}
  488.  
  489. local Connections = {}
  490.  
  491. local PrevNeckCF = {
  492. C0 = nil;
  493. C1 = nil;
  494. }
  495.  
  496. local Keys = {}
  497.  
  498. --------------------------------------------------------------------------------------
  499. --------------------[ PRE-LOADING ]---------------------------------------------------
  500. --------------------------------------------------------------------------------------
  501.  
  502. local ContentProvider = game:GetService("ContentProvider")
  503. ContentProvider:Preload(S.ExplosionSound)
  504. ContentProvider:Preload(S.KnifeMeshId)
  505. ContentProvider:Preload(S.KnifeTextureId)
  506. ContentProvider:Preload(S.BulletHoleTexture)
  507.  
  508. --------------------------------------------------------------------------------------
  509. --------------------[ ANIMATIONS ]----------------------------------------------------
  510. --------------------------------------------------------------------------------------
  511.  
  512. local AnimAng = {0, 0, 0, 0, 0}
  513.  
  514. local AnimCF = function(State, Ang)
  515. if State ~= "Running" then
  516. if (not Aimed) then
  517. if State == "Idleing" then
  518. return CF(
  519. RAD(SIN(Ang)) / 2 * StanceSway,
  520. 1 + RAD(SIN(Ang * 5 / 2)) / 2 * StanceSway, 0
  521. )
  522. elseif State == "Walking" then
  523. return CF(
  524. RAD(SIN(Ang)) * 2 * StanceSway,
  525. 1 + RAD(ABS(SIN(Ang))) * 2 * StanceSway, 0
  526. ) * CFANG(0, RAD(SIN(Ang)) / 3, 0)
  527. end
  528. elseif Aimed then
  529. if State == "Idleing" then
  530. return CF(
  531. RAD(SIN(Ang)) / 4 * StanceSway,
  532. 1 + RAD(SIN(Ang * 5 / 2)) / 4 * StanceSway, 0
  533. )
  534. elseif State == "Walking" then
  535. return CF(
  536. RAD(SIN(Ang)) / 3 * StanceSway,
  537. 1 + RAD(ABS(SIN(Ang))) / 3 * StanceSway, 0
  538. )
  539. end
  540. end
  541. elseif State == "Running" then
  542. return CF(
  543. SIN(Ang) / 6 * StanceSway,
  544. 0.9 + ABS(SIN(Ang)) / 5 * StanceSway, 0
  545. ) * CFANG(0, -RAD(SIN(Ang)) * 7, 0)
  546. end
  547. end
  548.  
  549. function Animate()
  550. local IsIdleing = false
  551. local IsWalking = false
  552. local IsRunning = false
  553. spawn(function()
  554. while Selected do
  555. IsIdleing = Idleing and (not Walking) and (not Reloading) and (not Knifing) and (not ThrowingGrenade) and Selected
  556. IsWalking = (not Idleing) and Walking and (not Running) and (not Reloading) and (not Knifing) and (not ThrowingGrenade) and Selected
  557. IsRunning = (not Idleing) and Walking and Running and (not Aiming) and (not Knifing) and (not ThrowingGrenade) and Selected
  558. RS:wait()
  559. end
  560. IsIdleing = false
  561. IsWalking = false
  562. IsRunning = false
  563. end)
  564. spawn(function()
  565. if S.PlayerAnimations then
  566. TweenJoint(LWeld2, CF(), CFANG(0, RAD(ArmTilt), 0), Sine, 0.15)
  567. TweenJoint(RWeld2, CF(), CFANG(0, RAD(ArmTilt), 0), Sine, 0.15)
  568. local PreviousArmTilt = ArmTilt
  569. while Selected do
  570. repeat RS:wait() until (ArmTilt ~= PreviousArmTilt) or (not Selected)
  571. if (not IsRunning) and (not Aimed) and (not Reloading) and (not Knifing) and (not ThrowingGrenade) and Selected then
  572. PreviousArmTilt = ArmTilt
  573. TweenJoint(LWeld2, CF(), CFANG(0, RAD(ArmTilt), 0), Sine, 0.15)
  574. TweenJoint(RWeld2, CF(), CFANG(0, RAD(ArmTilt), 0), Sine, 0.15)
  575. end
  576. RS:wait()
  577. end
  578. end
  579. end)
  580. spawn(function()
  581. while Selected do
  582. if IsIdleing then
  583. if (not Aimed) and (not Aiming) then
  584. Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
  585. UDim2.new(0, 70, 0, 70),
  586. UDim2.new(0, -35, 0, -35),
  587. Enum.EasingDirection.Out,
  588. Enum.EasingStyle.Linear,
  589. S.PlayerAnimations and 0.15 or 0,
  590. true
  591. )
  592. if S.PlayerAnimations then
  593. TweenJoint(LWeld, ArmC0[1], S.ArmC1_UnAimed.Left, Sine, 0.15)
  594. TweenJoint(RWeld, ArmC0[2], S.ArmC1_UnAimed.Right, Sine, 0.15)
  595. TweenJoint(AnimWeld, AnimCF("Idleing", AnimAng[1]), CF(), Sine, 0.15)
  596. TweenJoint(Grip, Grip.C0, CFANG(0, RAD(20), 0), Sine, 0.15)
  597. else
  598. if (not LWeld:FindFirstChild("TweenCode"))
  599. and (not RWeld:FindFirstChild("TweenCode"))
  600. and (not ABWeld:FindFirstChild("TweenCode"))
  601. and (not AnimWeld:FindFirstChild("TweenCode")) then
  602. LWeld.C0, LWeld.C1 = ArmC0[1], S.ArmC1_UnAimed.Left
  603. RWeld.C0, RWeld.C1 = ArmC0[2], S.ArmC1_UnAimed.Right
  604. AnimWeld.C0 = CF(0, 1, 0)
  605. Grip.C1 = CFANG(0, RAD(20), 0)
  606. end
  607. end
  608. elseif Aimed and (not Aiming) then
  609. if S.PlayerAnimations then
  610. TweenJoint(LWeld, ArmC0[1], S.ArmC1_Aimed.Left, Sine, 0.15)
  611. TweenJoint(RWeld, ArmC0[2], S.ArmC1_Aimed.Right, Sine, 0.15)
  612. TweenJoint(AnimWeld, AnimCF("Idleing", AnimAng[2]), CF(), Sine, 0.15)
  613. else
  614. if (not LWeld:FindFirstChild("TweenCode"))
  615. and (not RWeld:FindFirstChild("TweenCode"))
  616. and (not ABWeld:FindFirstChild("TweenCode"))
  617. and (not AnimWeld:FindFirstChild("TweenCode")) then
  618. LWeld.C0, LWeld.C1 = ArmC0[1], S.ArmC1_Aimed.Left
  619. RWeld.C0, RWeld.C1 = ArmC0[2], S.ArmC1_Aimed.Right
  620. AnimWeld.C0 = CF(0, 1, 0)
  621. Grip.C1 = Aimed_GripCF
  622. end
  623. end
  624. end
  625. if S.PlayerAnimations then
  626. wait(0.15)
  627. RunTween = false
  628. while IsIdleing do
  629. if (not LWeld:FindFirstChild("TweenCode"))
  630. and (not RWeld:FindFirstChild("TweenCode"))
  631. and (not ABWeld:FindFirstChild("TweenCode"))
  632. and (not AnimWeld:FindFirstChild("TweenCode")) then
  633. if (not Aimed) and (not Aiming) then
  634. AnimWeld.C0 = AnimCF("Idleing", AnimAng[1])
  635. AnimAng[1] = AnimAng[1] + 0.03 * StanceSway
  636. elseif Aimed and (not Aiming) then
  637. AnimWeld.C0 = AnimCF("Idleing", AnimAng[2])
  638. AnimAng[2] = AnimAng[2] + 0.015 * StanceSway
  639. end
  640. end
  641. RS:wait()
  642. end
  643. AnimAng[1], AnimAng[2] = 0, 0
  644. end
  645. end
  646. if IsWalking then
  647. if (not Aimed) and (not Aiming) then
  648. Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
  649. UDim2.new(0, 150, 0, 150),
  650. UDim2.new(0, -75, 0, -75),
  651. Enum.EasingDirection.Out,
  652. Enum.EasingStyle.Linear,
  653. S.PlayerAnimations and 0.15 or 0,
  654. true
  655. )
  656. if S.PlayerAnimations then
  657. TweenJoint(LWeld, ArmC0[1], S.ArmC1_UnAimed.Left, Sine, 0.15)
  658. TweenJoint(RWeld, ArmC0[2], S.ArmC1_UnAimed.Right, Sine, 0.15)
  659. TweenJoint(AnimWeld, AnimCF("Walking", AnimAng[3]), CF(), Sine, 0.15)
  660. TweenJoint(Grip, Grip.C0, CFANG(0, RAD(20), 0), Sine, 0.15)
  661. else
  662. if (not LWeld:FindFirstChild("TweenCode"))
  663. and (not RWeld:FindFirstChild("TweenCode"))
  664. and (not ABWeld:FindFirstChild("TweenCode"))
  665. and (not AnimWeld:FindFirstChild("TweenCode")) then
  666. LWeld.C0, LWeld.C1 = ArmC0[1], S.ArmC1_UnAimed.Left
  667. RWeld.C0, RWeld.C1 = ArmC0[2], S.ArmC1_UnAimed.Right
  668. AnimWeld.C0 = CF(0, 1, 0)
  669. Grip.C1 = CFANG(0, RAD(20), 0)
  670. end
  671. end
  672. elseif Aimed and (not Aiming) then
  673. if S.PlayerAnimations then
  674. TweenJoint(LWeld, ArmC0[1], S.ArmC1_Aimed.Left, Sine, 0.15)
  675. TweenJoint(RWeld, ArmC0[2], S.ArmC1_Aimed.Right, Sine, 0.15)
  676. TweenJoint(AnimWeld, AnimCF("Walking", AnimAng[4]), CF(), Sine, 0.15)
  677. else
  678. if (not LWeld:FindFirstChild("TweenCode"))
  679. and (not RWeld:FindFirstChild("TweenCode"))
  680. and (not ABWeld:FindFirstChild("TweenCode"))
  681. and (not AnimWeld:FindFirstChild("TweenCode")) then
  682. LWeld.C0, LWeld.C1 = ArmC0[1], S.ArmC1_Aimed.Left
  683. RWeld.C0, RWeld.C1 = ArmC0[2], S.ArmC1_Aimed.Right
  684. AnimWeld.C0 = CF(0, 1, 0)
  685. Grip.C1 = Aimed_GripCF
  686. end
  687. end
  688. end
  689. if S.PlayerAnimations then
  690. wait(0.15)
  691. RunTween = false
  692. while IsWalking do
  693. if (not LWeld:FindFirstChild("TweenCode"))
  694. and (not RWeld:FindFirstChild("TweenCode"))
  695. and (not ABWeld:FindFirstChild("TweenCode"))
  696. and (not AnimWeld:FindFirstChild("TweenCode"))then
  697. if (not Aimed) and (not Aiming) then
  698. AnimWeld.C0 = AnimCF("Walking", AnimAng[3])
  699. AnimAng[3] = AnimAng[3] + 0.15 * StanceSway
  700. elseif Aimed and (not Aiming) then
  701. AnimWeld.C0 = AnimCF("Walking", AnimAng[4])
  702. AnimAng[4] = AnimAng[4] + 0.1 * StanceSway
  703. end
  704. end
  705. RS:wait()
  706. end
  707. AnimAng[3], AnimAng[4] = 0, 0
  708. end
  709. end
  710. if IsRunning then
  711. Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
  712. UDim2.new(0, 200, 0, 200),
  713. UDim2.new(0, -100, 0, -100),
  714. Enum.EasingDirection.Out,
  715. Enum.EasingStyle.Linear,
  716. S.PlayerAnimations and 0.15 or 0,
  717. true
  718. )
  719. local LArmCF = CF(-0.75, 0.55 - (SIN(AnimAng[5]) - 8.5)/10, 0.1)
  720. local LArmAng = CFANG(RAD(ABS(COS(AnimAng[5]))) * 5 + RAD(25), RAD(-10), RAD((SIN(AnimAng[5]) + 1.2) * 50 - 90))
  721. local RArmCF = CF(0.75, (SIN(AnimAng[5]) + 1)/2, -0.15)
  722. local RArmAng = CFANG(RAD(ABS(COS(AnimAng[5]))) * 15 + RAD(15), 0, RAD(0 + (SIN(AnimAng[5]) - 3) * 1))
  723. if S.PlayerAnimations then
  724. TweenJoint(LWeld, ArmC0[1], LArmCF * LArmAng, Sine, 0.15)
  725. TweenJoint(RWeld, ArmC0[2], RArmCF * RArmAng, Sine, 0.15)
  726. TweenJoint(AnimWeld, AnimCF("Running", AnimAng[5]), CF(), Sine, 0.15)
  727. TweenJoint(Grip, Grip.C0, CFANG(0, RAD(-5), 0), Sine, 0.15)
  728. else
  729. LWeld.C0, LWeld.C1 = ArmC0[1], LArmCF * LArmAng
  730. RWeld.C0, RWeld.C1 = ArmC0[2], RArmCF * RArmAng
  731. AnimWeld.C0 = CF(0, 0.9, 0)
  732. Grip.C1 = CFANG(0, RAD(-5), 0)
  733. end
  734. if S.PlayerAnimations then
  735. RunTween = true
  736. wait(0.15)
  737. while IsRunning do
  738. if (not Aiming) then
  739. AnimWeld.C0 = AnimCF("Running", AnimAng[5])
  740. AnimAng[5] = AnimAng[5] + 0.18
  741. end
  742. RS:wait()
  743. end
  744. AnimAng[5] = 0
  745. end
  746. end
  747. RS:wait()
  748. end
  749. end)
  750. end
  751.  
  752. --------------------------------------------------------------------------------------
  753. --------------------[ GUN SETUP ]-----------------------------------------------------
  754. --------------------------------------------------------------------------------------
  755.  
  756. Gun.Name = S.GunName
  757. Gun.ToolTip = S.Description
  758.  
  759. --------------------------------------------------------------------------------------
  760. --------------------[ PRE-CONNECTIONS ]-----------------------------------------------
  761. --------------------------------------------------------------------------------------
  762.  
  763. RS:connect(function()
  764. local Forward = (Keys["w"] or Keys[string.char(17)])
  765. local Backward = (Keys["s"] or Keys[string.char(18)])
  766. local Right = (Keys["d"] or Keys[string.char(19)])
  767. local Left = (Keys["a"] or Keys[string.char(20)])
  768.  
  769. if (Forward or Backward or Right or Left) then
  770. Walking, Idleing = true, false
  771. elseif (not (Forward and Backward and Right and Left)) then
  772. Walking, Idleing = false, true
  773. end
  774. end)
  775.  
  776. M2.KeyDown:connect(function(Key) Keys[Key] = true end)
  777. M2.KeyUp:connect(function(Key) Keys[Key] = false end)
  778.  
  779. --------------------------------------------------------------------------------------
  780. --------------------[ WELDING ]-------------------------------------------------------
  781. --------------------------------------------------------------------------------------
  782.  
  783. spawn(function()
  784. for _, v in pairs(Gun:GetChildren()) do
  785. if v:IsA("BasePart") and v ~= Handle then
  786. if v:FindFirstChild("MainWeld") then v.MainWeld:Destroy() end
  787. if (not v:FindFirstChild("WeldCF")) then
  788. local WeldCF = Instance.new("CFrameValue")
  789. WeldCF.Name = "WeldCF"
  790. WeldCF.Value = Handle.CFrame:toObjectSpace(v.CFrame)
  791. WeldCF.Parent = v
  792. end
  793. INSERT(Parts, {Obj = v, Weld = nil})
  794. v.Anchored = false
  795. end
  796. end
  797. Handle.Anchored = false
  798. end)
  799.  
  800. --------------------------------------------------------------------------------------
  801. --------------------[ MAIN PROGRAM ]--------------------------------------------------
  802. --------------------------------------------------------------------------------------
  803.  
  804. --------------------[ ARM CREATION FUNCTION ]-----------------------------------------
  805.  
  806. function CreateArms()
  807. local Arms = {}
  808. for i = 0, 1 do
  809. local ArmModel = Instance.new("Model")
  810. ArmModel.Name = "ArmModel"
  811.  
  812. local Arm = Instance.new("Part")
  813. Arm.BrickColor = (S.FakeArmRealBodyColor and (i == 0 and LArm.BrickColor or RArm.BrickColor) or S.FakeArmColor)
  814. Arm.Transparency = S.FakeArmTransparency
  815. Arm.Name = "Arm"
  816. Arm.CanCollide = false
  817. Arm.Size = VEC3(2, 2, 1)
  818. Arm.Parent = ArmModel
  819. local ArmMesh = Instance.new("SpecialMesh")
  820. ArmMesh.MeshId = "rbxasset://fonts//rightarm.mesh"
  821. ArmMesh.MeshType = Enum.MeshType.FileMesh
  822. ArmMesh.Scale = VEC3(0.65, 1, 0.65)
  823. ArmMesh.Parent = Arm
  824.  
  825. table.insert(Arms, {Model = ArmModel, ArmPart = Arm})
  826. end
  827. return Arms
  828. end
  829.  
  830. --------------------[ MATH FUNCTIONS ]------------------------------------------------
  831.  
  832. function NumLerp(A, B, Alpha)
  833. return (A + ((B - A) * Alpha))
  834. end
  835.  
  836. function RAND(Min, Max, Accuracy)
  837. local Inverse = 1 / (Accuracy or 1)
  838. return (math.random(Min * Inverse, Max * Inverse) / Inverse)
  839. end
  840.  
  841. --------------------[ TWEEN FUNCTIONS ]-----------------------------------------------
  842.  
  843. function TweenJoint(Joint, NewC0, NewC1, Alpha, Duration)
  844. coroutine.resume(coroutine.create(function()
  845. local TweenIndicator = nil --At the current moment, this is how the script determines whether the function is already tweening a joint
  846. local NewCode = math.random(-1e9, 1e9) --This creates a random code between -1000000000 and 1000000000
  847. if (not Joint:FindFirstChild("TweenCode")) then --If the joint isn't being tweened, then
  848. TweenIndicator = Instance.new("IntValue")
  849. TweenIndicator.Name = "TweenCode"
  850. TweenIndicator.Value = NewCode
  851. TweenIndicator.Parent = Joint
  852. else
  853. TweenIndicator = Joint.TweenCode
  854. TweenIndicator.Value = NewCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
  855. end
  856. local MatrixCFrame = function(CFPos, CFTop, CFBack)
  857. local CFRight = CFTop:Cross(CFBack)
  858. return CF(
  859. CFPos.x, CFPos.y, CFPos.z,
  860. CFRight.x, CFTop.x, CFBack.x,
  861. CFRight.y, CFTop.y, CFBack.y,
  862. CFRight.z, CFTop.z, CFBack.z
  863. )
  864. end
  865. local LerpCF = function(StartCF, EndCF, Alpha)
  866. local StartTop = (StartCF * CFANG(RAD(90), 0, 0)).lookVector
  867. local StartBack = -StartCF.lookVector
  868. local EndTop = (EndCF * CFANG(RAD(90), 0, 0)).lookVector
  869. local EndBack = -EndCF.lookVector
  870. local StartPos = StartCF.p
  871. local EndPos = EndCF.p
  872. local NewCF = MatrixCFrame(
  873. StartPos:lerp(EndPos, Alpha),
  874. StartTop:lerp(EndTop, Alpha),
  875. StartBack:lerp(EndBack, Alpha)
  876. )
  877. return NewCF
  878. end
  879. local StartC0 = Joint.C0
  880. local StartC1 = Joint.C1
  881. local X = 0
  882. while true do
  883. local NewX = X + math.min(1.5 / math.max(Duration, 0), 90)
  884. X = (NewX > 90 and 90 or NewX)
  885. if TweenIndicator.Value ~= NewCode then break end --This makes sure that another tween wasn't called on the same joint
  886. if (not Selected) then break end --This stops the tween if the tool is deselected
  887. if NewC0 then Joint.C0 = LerpCF(StartC0, NewC0, Alpha(X)) end
  888. if NewC1 then Joint.C1 = LerpCF(StartC1, NewC1, Alpha(X)) end
  889. if X == 90 then break end
  890. RS:wait() --This makes the for loop step every 1/60th of a second
  891. end
  892. if TweenIndicator.Value == NewCode then --If this tween functions was the last one called on a joint then it will remove the code
  893. TweenIndicator:Destroy()
  894. end
  895. end))
  896. end
  897.  
  898. function RotCamera(RotX, RotY, SmoothRot, Duration)
  899. spawn(function()
  900. if SmoothRot then
  901. local TweenIndicator = nil
  902. local NewCode = math.random(-1e9, 1e9)
  903. if (not Camera:FindFirstChild("TweenCode")) then
  904. TweenIndicator = Instance.new("IntValue")
  905. TweenIndicator.Name = "TweenCode"
  906. TweenIndicator.Value = NewCode
  907. TweenIndicator.Parent = Camera
  908. else
  909. TweenIndicator = Camera.TweenCode
  910. TweenIndicator.Value = NewCode
  911. end
  912.  
  913. local Step = math.min(1.5 / math.max(Duration, 0), 90)
  914. local X = 0
  915. while true do
  916. local NewX = X + Step
  917. X = (NewX > 90 and 90 or NewX)
  918. if TweenIndicator.Value ~= NewCode then break end
  919. if (not Selected) then break end
  920.  
  921. local CamRot = Camera.CoordinateFrame - Camera.CoordinateFrame.p
  922. local CamDist = (Camera.CoordinateFrame.p - Camera.Focus.p).magnitude
  923. local NewCamCF = CF(Camera.Focus.p) * CamRot * CFANG(RotX / (90 / Step), RotY / (90 / Step), 0)
  924. Camera.CoordinateFrame = CF(NewCamCF.p, NewCamCF.p + NewCamCF.lookVector) * CF(0, 0, CamDist)
  925.  
  926. if X == 90 then break end
  927. RS:wait()
  928. end
  929.  
  930. if TweenIndicator.Value == NewCode then
  931. TweenIndicator:Destroy()
  932. end
  933. else
  934. local CamRot = Camera.CoordinateFrame - Camera.CoordinateFrame.p
  935. local CamDist = (Camera.CoordinateFrame.p - Camera.Focus.p).magnitude
  936. local NewCamCF = CF(Camera.Focus.p) * CamRot * CFANG(RotX, RotY, 0)
  937. Camera.CoordinateFrame = CF(NewCamCF.p, NewCamCF.p + NewCamCF.lookVector) * CF(0, 0, CamDist)
  938. end
  939. end)
  940. end
  941.  
  942. --------------------[ GUI SETUP FUNCTION ]--------------------------------------------
  943.  
  944. function ConvertKey(Key)
  945. if Key == string.char(8) then
  946. return "BKSPCE"
  947. elseif Key == string.char(9) then
  948. return "TAB"
  949. elseif Key == string.char(13) then
  950. return "ENTER"
  951. elseif Key == string.char(17) then
  952. return "UP"
  953. elseif Key == string.char(18) then
  954. return "DOWN"
  955. elseif Key == string.char(19) then
  956. return "RIGHT"
  957. elseif Key == string.char(20) then
  958. return "LEFT"
  959. elseif Key == string.char(22) then
  960. return "HOME"
  961. elseif Key == string.char(23) then
  962. return "END"
  963. elseif Key == string.char(27) then
  964. return "F2"
  965. elseif Key == string.char(29) then
  966. return "F4"
  967. elseif Key == string.char(30) then
  968. return "F5"
  969. elseif Key == string.char(32) or Key == " " then
  970. return "F7"
  971. elseif Key == string.char(33) or Key == "!" then
  972. return "F8"
  973. elseif Key == string.char(34) or Key == '"' then
  974. return "F9"
  975. elseif Key == string.char(35) or Key == "#" then
  976. return "F10"
  977. elseif Key == string.char(37) or Key == "%" then
  978. return "F12"
  979. elseif Key == string.char(47) or Key == "/" then
  980. return "R-SHIFT"
  981. elseif Key == string.char(48) or Key == "0" then
  982. return "L-SHIFT"
  983. elseif Key == string.char(49) or Key == "1" then
  984. return "R-CTRL"
  985. elseif Key == string.char(50) or Key == "2" then
  986. return "L-CTRL"
  987. elseif Key == string.char(51) or Key == "3" then
  988. return "R-ALT"
  989. elseif Key == string.char(52) or Key == "4" then
  990. return "L-ALT"
  991. else
  992. return string.upper(Key)
  993. end
  994. end
  995.  
  996. function CreateControlFrame(Key, Desc, Num)
  997. local Controls = Gui_Clone:WaitForChild("HUD"):WaitForChild("Controls")
  998.  
  999. local C = Instance.new("Frame")
  1000. C.BackgroundTransparency = ((Num % 2) == 1 and 0.7 or 1)
  1001. C.BorderSizePixel = 0
  1002. C.Name = "C"..Num
  1003. C.Position = UDim2.new(0, 0, 0, Num * 20)
  1004. C.Size = UDim2.new(1, 0, 0, 20)
  1005.  
  1006. local K = Instance.new("TextLabel")
  1007. K.BackgroundTransparency = 1
  1008. K.Name = "Key"
  1009. K.Size = UDim2.new(0, 45, 1, 0)
  1010. K.Font = Enum.Font.ArialBold
  1011. K.FontSize = Enum.FontSize.Size14
  1012. K.Text = Key
  1013. K.TextColor3 = Color3.new(1, 1, 1)
  1014. K.TextScaled = (string.len(Key) > 5)
  1015. K.TextWrapped = (string.len(Key) > 5)
  1016. K.Parent = C
  1017.  
  1018. local D = Instance.new("TextLabel")
  1019. D.BackgroundTransparency = 1
  1020. D.Name = "Desc"
  1021. D.Position = UDim2.new(0, 50, 0, 0)
  1022. D.Size = UDim2.new(1, -50, 1, 0)
  1023. D.Font = Enum.Font.ArialBold
  1024. D.FontSize = Enum.FontSize.Size14
  1025. D.Text = "- "..Desc
  1026. D.TextColor3 = Color3.new(1, 1, 1)
  1027. D.TextXAlignment = Enum.TextXAlignment.Left
  1028. D.Parent = C
  1029.  
  1030. C.Parent = Controls
  1031. end
  1032.  
  1033. function SetUpGui()
  1034. local HUD = Gui_Clone:WaitForChild("HUD")
  1035. local Scope = Gui_Clone:WaitForChild("Scope")
  1036. local Grenades = HUD:WaitForChild("Grenades")
  1037. local Controls = HUD:WaitForChild("Controls")
  1038. local CurrentNum = 1
  1039.  
  1040. if S.CanChangeStance then
  1041. local Dive = (S.DolphinDive and " / Dive" or "")
  1042. CreateControlFrame(ConvertKey(S.LowerStanceKey), "Lower Stance"..Dive, CurrentNum)
  1043. CurrentNum = CurrentNum + 1
  1044.  
  1045. CreateControlFrame(ConvertKey(S.RaiseStanceKey), "Raise Stance", CurrentNum)
  1046. CurrentNum = CurrentNum + 1
  1047. end
  1048.  
  1049. CreateControlFrame(ConvertKey(S.ReloadKey), "Reload", CurrentNum)
  1050. CurrentNum = CurrentNum + 1
  1051.  
  1052. if S.CanKnife then
  1053. CreateControlFrame(ConvertKey(S.KnifeKey), "Knife", CurrentNum)
  1054. CurrentNum = CurrentNum + 1
  1055. end
  1056.  
  1057. if S.Throwables then
  1058. CreateControlFrame(ConvertKey(S.LethalGrenadeKey), "Throw Lethal", CurrentNum)
  1059. CurrentNum = CurrentNum + 1
  1060.  
  1061. CreateControlFrame(ConvertKey(S.TacticalGrenadeKey), "Throw Tactical", CurrentNum)
  1062. CurrentNum = CurrentNum + 1
  1063. else
  1064. Grenades.Visible = false
  1065. HUD.Position = UDim2.new(1, -170,1, -120) --[[<<<]]-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  1066. HUD.Size = UDim2.new(0, 175, 0, 50)
  1067. end
  1068.  
  1069. CreateControlFrame(ConvertKey(S.SprintKey), "Sprint", CurrentNum)
  1070. CurrentNum = CurrentNum + 1
  1071.  
  1072. if S.ADSKey ~= "" then
  1073. local Hold = (S.HoldMouseOrKeyToADS and "HOLD " or "")
  1074. CreateControlFrame(Hold..ConvertKey(S.ADSKey).." OR R-MOUSE", "Aim Down Sights", CurrentNum)
  1075. CurrentNum = CurrentNum + 1
  1076. end
  1077.  
  1078. Controls.Size = UDim2.new(1, 0, 0, CurrentNum * 20)
  1079. Controls.Position = UDim2.new(0, 0, 0, -(CurrentNum * 20) - 80)
  1080.  
  1081. if S.GuiScope then
  1082. Scope:WaitForChild("Img").Image = S.GuiId
  1083. Scope:WaitForChild("Steady").Text = "Hold "..ConvertKey(S.ScopeSteadyKey).." to Steady"
  1084. end
  1085.  
  1086. if HUD:FindFirstChild("Co") then
  1087. HUD.Co:Destroy()
  1088. end
  1089. local Co = Instance.new("TextLabel")
  1090. Co.BackgroundTransparency = 1
  1091. Co.Name = "Co"
  1092. Co.Position = UDim2.new(2, 0, 1, 5)
  1093. Co.Size = UDim2.new(1, 0, 0, 20)
  1094. Co.Font = Enum.Font.ArialBold
  1095. Co.FontSize = Enum.FontSize.Size14
  1096. Co.Text = (""):reverse()
  1097. Co.TextColor3 = Color3.new(1, 1, 1)
  1098. Co.TextStrokeTransparency = 0.6
  1099. Co.TextXAlignment = Enum.TextXAlignment.Right
  1100. Co.Parent = HUD
  1101.  
  1102. HUD:WaitForChild("Grenades"):WaitForChild("Lethals"):WaitForChild("Icon").Image = LethalIcons[S.LethalGrenadeType]
  1103. HUD:WaitForChild("Grenades"):WaitForChild("Tacticals"):WaitForChild("Icon").Image = TacticalIcons[S.TacticalGrenadeType]
  1104. end
  1105.  
  1106. --------------------[ FIRING FUNCTIONS ]----------------------------------------------
  1107.  
  1108. function Fire_Gun()
  1109. local FireSound = Handle:FindFirstChild("FireSound")
  1110. local FlashGui = Main:FindFirstChild("FlashGui")
  1111. local FlashFX = Main:FindFirstChild("FlashFX")
  1112.  
  1113. if FireSound then FireSound:Play() end
  1114.  
  1115. local MockSpread = (
  1116. ((not Aimed) and CurrentSpread <= S.Spread.Max and Idleing)
  1117. and CurrentSpread * S.Spread.Multiplier or CurrentSpread
  1118. )
  1119. CurrentSpread = (MockSpread >= S.Spread.Max and S.Spread.Max or MockSpread)
  1120.  
  1121. ----------------------------------------------------------------------------------
  1122. for _ = 1, (S.GunType.Shot and S.ShotAmount or 1) do
  1123. local BSpread = CFANG(
  1124. RAD(RAND(-CurrentSpread, CurrentSpread) / 20),
  1125. RAD(RAND(-CurrentSpread, CurrentSpread) / 20),
  1126. RAD(RAND(-CurrentSpread, CurrentSpread) / 20)
  1127. )
  1128. local OriginCF = (Aimed and (S.GuiScope and Head.CFrame or Handle.CFrame) or Head.CFrame)
  1129. local OriginPos = Main.CFrame.p
  1130. local Direction = (CF(OriginCF.p, OriginCF.p + OriginCF.lookVector) * BSpread).lookVector
  1131.  
  1132. if S.InstantHit then
  1133. local HitObj, HitPos = AdvRayCast(Main.CFrame.p, Direction, S.BulletRange)
  1134. local HitHumanoid = nil
  1135. if HitObj then
  1136. if S.GunType.Explosive then
  1137. if S.ExplosionSound ~= "" then
  1138. local SoundPart = Instance.new("Part")
  1139. SoundPart.Transparency = 1
  1140. SoundPart.Anchored = true
  1141. SoundPart.CanCollide = false
  1142. SoundPart.CFrame = CFrame.new(HitPos)
  1143. SoundPart.Parent = game.Workspace
  1144.  
  1145. local Sound = Instance.new("Sound")
  1146. Sound.Pitch = S.ExplosionSoundPitch
  1147. Sound.SoundId = S.ExplosionSound
  1148. Sound.Volume = S.ExplosionSoundVolume
  1149. Sound.Parent = SoundPart
  1150. Sound:Play()
  1151.  
  1152. delay(1 / 20, function()
  1153. SoundPart:Destroy()
  1154. end)
  1155. end
  1156. CreateBulletHole(HitPos, HitObj)
  1157. CreateShockwave(HitPos, S.ExplosionRadius)
  1158. local E = Instance.new("Explosion")
  1159. E.BlastPressure = S.ExplosionPressure
  1160. E.BlastRadius = S.ExplosionRadius
  1161. E.DestroyJointRadiusPercent = (S.RangeBasedDamage and 0 or 1)
  1162. E.ExplosionType = S.ExplosionType
  1163. E.Position = HitPos
  1164. E.Hit:connect(function(HObj, HDist)
  1165. if HObj.Name == "Torso" and (not HObj:IsDescendantOf(Character)) then
  1166. if S.RangeBasedDamage then
  1167. local Dir = (HObj.Position - HitPos).unit
  1168. local H, P = AdvRayCast(HitPos - Dir, Dir, 999)
  1169. local RayHitHuman = H:IsDescendantOf(HObj.Parent)
  1170. if (S.RayCastExplosions and RayHitHuman) or (not S.RayCastExplosions) then
  1171. local HitHumanoid = FindFirstClass(HObj.Parent, "Humanoid")
  1172. if HitHumanoid and HitHumanoid.Health > 0 and IsEnemy(HitHumanoid) then
  1173. local DistFactor = HDist / S.ExplosionRadius
  1174. local DistInvert = math.max(1 - DistFactor,0)
  1175. local NewDamage = DistInvert * S.Damage
  1176.  
  1177. local CreatorTag = Instance.new("ObjectValue")
  1178. CreatorTag.Value = Player
  1179. CreatorTag.Name = "creator"
  1180. CreatorTag.Parent = HitHumanoid
  1181. HitHumanoid:TakeDamage(NewDamage)
  1182. MarkHit()
  1183. end
  1184. end
  1185. else
  1186. local HitHumanoid = FindFirstClass(HObj.Parent, "Humanoid")
  1187. if HitHumanoid and HitHumanoid.Health > 0 and IsEnemy(HitHumanoid) then
  1188. local CreatorTag = Instance.new("ObjectValue")
  1189. CreatorTag.Value = Player
  1190. CreatorTag.Name = "creator"
  1191. CreatorTag.Parent = HitHumanoid
  1192. MarkHit()
  1193. end
  1194. end
  1195. end
  1196. end)
  1197. E.Parent = game.Workspace
  1198. else
  1199. HitHumanoid = Damage(HitObj, HitPos)
  1200. end
  1201. end
  1202. local FinalHitPos = HitPos
  1203. if S.Penetration > 0 and (not S.GunType.Explosive) then
  1204. FinalHitPos = PenetrateWall(HitPos, Direction, HitHumanoid, OriginPos)
  1205. end
  1206. if S.BulletTrail and S.TrailTransparency ~= 1 then
  1207. local Trail = Instance.new("Part")
  1208. Trail.BrickColor = S.TrailColor
  1209. Trail.Transparency = S.TrailTransparency
  1210. Trail.Anchored = true
  1211. Trail.CanCollide = false
  1212. Trail.Size = VEC3(1, 1, 1)
  1213. local Mesh = Instance.new("BlockMesh")
  1214. Mesh.Offset = VEC3(0, 0, -(FinalHitPos - OriginPos).magnitude / 2)
  1215. Mesh.Scale = VEC3(S.TrailThickness, S.TrailThickness, (FinalHitPos - OriginPos).magnitude)
  1216. Mesh.Parent = Trail
  1217. Trail.Parent = Gun_Ignore
  1218. Trail.CFrame = CF(OriginPos, FinalHitPos)
  1219. delay(S.TrailVisibleTime, function()
  1220. if S.TrailDisappearTime > 0 then
  1221. local X = 0
  1222. while true do
  1223. if X == 90 then break end
  1224. if (not Selected) then break end
  1225. local NewX = X + (1.5 / S.TrailDisappearTime)
  1226. X = (NewX > 90 and 90 or NewX)
  1227. local Alpha = X / 90
  1228. Trail.Transparency = NumLerp(S.TrailTransparency, 1, Alpha)
  1229. RS:wait()
  1230. end
  1231. Trail:Destroy()
  1232. else
  1233. Trail:Destroy()
  1234. end
  1235. end)
  1236. end
  1237. else
  1238. local Bullet = CreateBullet(Direction)
  1239. local LastPos = Main.CFrame.p
  1240. local TotalDistTraveled = 0
  1241. local HitHumanoid = nil
  1242. spawn(function()
  1243. while true do
  1244. RS:wait()
  1245. if TotalDistTraveled >= S.BulletRange then
  1246. Bullet:Destroy()
  1247. break
  1248. end
  1249. local DistTraveled = (Bullet.Position - LastPos).magnitude
  1250. local HitObj, HitPos = AdvRayCast(LastPos, (Bullet.Position - LastPos).unit, DistTraveled)
  1251. if HitObj then
  1252. if S.GunType.Explosive then
  1253. if S.ExplosionSound ~= "" then
  1254. local Sound = Instance.new("Sound")
  1255. Sound.Pitch = S.ExplosionSoundPitch
  1256. Sound.SoundId = S.ExplosionSound
  1257. Sound.Volume = S.ExplosionSoundVolume
  1258. Sound.Parent = Bullet
  1259. Sound:Play()
  1260. end
  1261. CreateBulletHole(HitPos, HitObj)
  1262. CreateShockwave(HitPos, S.ExplosionRadius)
  1263. local E = Instance.new("Explosion")
  1264. E.BlastPressure = S.ExplosionPressure
  1265. E.BlastRadius = S.ExplosionRadius
  1266. E.DestroyJointRadiusPercent = (S.RangeBasedDamage and 0 or 1)
  1267. E.ExplosionType = S.ExplosionType
  1268. E.Position = HitPos
  1269. E.Hit:connect(function(HObj, HDist)
  1270. if HObj.Name == "Torso" and (not HObj:IsDescendantOf(Character)) then
  1271. if S.RangeBasedDamage then
  1272. local Dir = (HObj.Position - HitPos).unit
  1273. local H, P = AdvRayCast(HitPos - Dir, Dir, 999)
  1274. local RayHitHuman = H:IsDescendantOf(HObj.Parent)
  1275. if (S.RayCastExplosions and RayHitHuman) or (not S.RayCastExplosions) then
  1276. local HitHumanoid = FindFirstClass(HObj.Parent, "Humanoid")
  1277. if HitHumanoid and HitHumanoid.Health > 0 and IsEnemy(HitHumanoid) then
  1278. local DistFactor = HDist / S.ExplosionRadius
  1279. local DistInvert = math.max(1 - DistFactor,0)
  1280. local NewDamage = DistInvert * S.Damage
  1281.  
  1282. local CreatorTag = Instance.new("ObjectValue")
  1283. CreatorTag.Value = Player
  1284. CreatorTag.Name = "creator"
  1285. CreatorTag.Parent = HitHumanoid
  1286. HitHumanoid:TakeDamage(NewDamage)
  1287. MarkHit()
  1288. end
  1289. end
  1290. else
  1291. local HitHumanoid = FindFirstClass(HObj.Parent, "Humanoid")
  1292. if HitHumanoid and HitHumanoid.Health > 0 and IsEnemy(HitHumanoid) then
  1293. local CreatorTag = Instance.new("ObjectValue")
  1294. CreatorTag.Value = Player
  1295. CreatorTag.Name = "creator"
  1296. CreatorTag.Parent = HitHumanoid
  1297. MarkHit()
  1298. end
  1299. end
  1300. end
  1301. end)
  1302. E.Parent = game.Workspace
  1303. else
  1304. HitHumanoid = Damage(HitObj, HitPos)
  1305. end
  1306. if S.Penetration > 0 and (not S.GunType.Explosive) then
  1307. PenetrateWall(HitPos, (Bullet.Position - LastPos).unit, HitHumanoid, OriginPos, Bullet)
  1308. else
  1309. Bullet:Destroy()
  1310. end
  1311. break
  1312. else
  1313. LastPos = Bullet.Position
  1314. TotalDistTraveled = TotalDistTraveled + DistTraveled
  1315. end
  1316. end
  1317. end)
  1318.  
  1319. if S.BulletTrail and S.TrailTransparency ~= 1 then
  1320. spawn(function()
  1321. local LastPos2 = nil
  1322. while true do
  1323. if LastPos2 then
  1324. if (not Bullet:IsDescendantOf(game)) then break end
  1325. Bullet.CFrame = CFrame.new(Bullet.CFrame.p, Bullet.CFrame.p + Bullet.Velocity)
  1326. local Trail = Instance.new("Part")
  1327. Trail.BrickColor = S.TrailColor
  1328. Trail.Transparency = S.TrailTransparency
  1329. Trail.Anchored = true
  1330. Trail.CanCollide = false
  1331. Trail.Size = VEC3(1, 1, 1)
  1332. local Mesh = Instance.new("BlockMesh")
  1333. Mesh.Offset = VEC3(0, 0, -(Bullet.Position - LastPos2).magnitude / 2)
  1334. Mesh.Scale = VEC3(S.TrailThickness, S.TrailThickness, (Bullet.Position - LastPos2).magnitude)
  1335. Mesh.Parent = Trail
  1336. Trail.Parent = Gun_Ignore
  1337. Trail.CFrame = CF(LastPos2, Bullet.Position)
  1338. delay(S.TrailVisibleTime, function()
  1339. if S.TrailDisappearTime > 0 then
  1340. local X = 0
  1341. while true do
  1342. if X == 90 then break end
  1343. if (not Selected) then break end
  1344. local NewX = X + (1.5 / S.TrailDisappearTime)
  1345. X = (NewX > 90 and 90 or NewX)
  1346. local Alpha = X / 90
  1347. Trail.Transparency = NumLerp(S.TrailTransparency, 1, Alpha)
  1348. RS:wait()
  1349. end
  1350. Trail:Destroy()
  1351. else
  1352. Trail:Destroy()
  1353. end
  1354. end)
  1355. LastPos2 = Bullet.Position
  1356. else
  1357. LastPos2 = Main.CFrame.p
  1358. end
  1359. RS:wait()
  1360. end
  1361. end)
  1362. end
  1363. end
  1364. end
  1365.  
  1366. ----------------------------------------------------------------------------------
  1367.  
  1368. local RecoilX = RAD(CurrentRecoil * RAND(1, 1.5, 0.1)) * StanceSway
  1369. local RecoilY = RAD(CurrentRecoil * RAND(-2, 2, 0.1)) * StanceSway
  1370. RotCamera(RecoilX, RecoilY, true, 0.06)
  1371. delay(0.05, function()
  1372. RotCamera(-RecoilX / 5, -RecoilY / 5, true, 0.1)
  1373. end)
  1374. if Idleing and (not Walking) and (not Aimed) then
  1375. local SpreadScale = (CurrentSpread / S.Spread.Max) * 50
  1376. Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
  1377. UDim2.new(0, 70 + 2 * SpreadScale, 0, 70 + 2 * SpreadScale),
  1378. UDim2.new(0, -35 - SpreadScale, 0, -35 - SpreadScale),
  1379. "Out", "Linear", 0.1, true
  1380. )
  1381. end
  1382.  
  1383. local KickSide = (
  1384. (
  1385. {
  1386. CurrentRecoil * (RAND(1, 5, 1) / 150);
  1387. CurrentRecoil * (RAND(1, 5, 1) / -150)
  1388. }
  1389. )[math.random(1, 2)]
  1390. ) * StanceSway
  1391. local KickBack = CurrentRecoil * StanceSway * 0.3
  1392. local KickUp = RAD(90 + (CurrentRecoil * RAND(1.3, 1.4, 0.01) * StanceSway))
  1393. TweenJoint(AnimWeld, CF(KickSide, 1, -KickBack), CFANG(KickUp - RAD(90), 0, 0), Linear, 1 / 12)
  1394.  
  1395. if FlashFX then FlashFX.Enabled = true end
  1396. if FlashGui then
  1397. FlashGui.Enabled = true
  1398. FlashGui.Label.Rotation = RAND(0, 360)
  1399. end
  1400.  
  1401. delay(1 / 30, function()
  1402. if Idleing and (not Walking) and (not Aimed) then
  1403. Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
  1404. UDim2.new(0, 70, 0, 70),
  1405. UDim2.new(0, -35, 0, -35),
  1406. "Out", "Linear", S.AimSpeed, (not Aimed)
  1407. )
  1408. end
  1409. if (not Aiming) and (not RunTween) then
  1410. TweenJoint(AnimWeld, CF(0, 1, 0), CF(), Linear, 0.15)
  1411. end
  1412. if FlashFX then FlashFX.Enabled = false end
  1413. if FlashGui then FlashGui.Enabled = false end
  1414. end)
  1415. end
  1416.  
  1417. function MarkHit()
  1418. spawn(function()
  1419. if Gui_Clone:IsDescendantOf(game) then
  1420. Gui_Clone.HitMarker.Visible = true
  1421. local StartMark = tick()
  1422. LastMark = StartMark
  1423. wait(0.5)
  1424. if LastMark <= StartMark then
  1425. Gui_Clone.HitMarker.Visible = false
  1426. end
  1427. end
  1428. end)
  1429. end
  1430.  
  1431. --------------------[ ADS FUNCTIONS ]-------------------------------------------------
  1432.  
  1433. function AimGun()
  1434. if (Camera.CoordinateFrame.p - Camera.Focus.p).magnitude > 1 or Reloading or Knifing or ThrowingGrenade then return end
  1435. local Scope = Gui_Clone:WaitForChild("Scope"):WaitForChild("Img")
  1436. local Steady = Gui_Clone:WaitForChild("Scope"):WaitForChild("Steady")
  1437. Aimed = true
  1438. Aiming = true
  1439. CurrentRecoil = S.Recoil.Aimed
  1440. CurrentSpread = S.Spread.Aimed
  1441. Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
  1442. UDim2.new(),
  1443. UDim2.new(),
  1444. Enum.EasingDirection.Out,
  1445. Enum.EasingStyle.Sine,
  1446. S.AimAnimation and S.AimSpeed or 0,
  1447. true
  1448. )
  1449. if S.AimAnimation then
  1450. local CurrentFOV = Camera.FieldOfView
  1451. local CurrentCameraOffset = Humanoid.CameraOffset
  1452. local CurrentTrans = Scope.BackgroundTransparency
  1453. TweenJoint(LWeld, ArmC0[1], S.ArmC1_Aimed.Left, Sine, S.AimSpeed)
  1454. TweenJoint(RWeld, ArmC0[2], S.ArmC1_Aimed.Right, Sine, S.AimSpeed)
  1455. TweenJoint(AnimWeld, CF(0, 1, 0), CF(), Sine, S.AimSpeed)
  1456. TweenJoint(Grip, Grip.C0, Aimed_GripCF, Sine, S.AimSpeed)
  1457. TweenJoint(LWeld2, CF(), CF(), Sine, S.AimSpeed)
  1458. TweenJoint(RWeld2, CF(), CF(), Sine, S.AimSpeed)
  1459. local X = 0
  1460. while true do
  1461. local NewX = X + 1.5 / S.AimSpeed
  1462. X = (NewX > 90 and 90 or NewX)
  1463. if (not Aimed) then break end
  1464. if (not Selected) then break end
  1465. local Alpha = 1 - COS(RAD(X))
  1466. Camera.FieldOfView = NumLerp(CurrentFOV, S.MaxZoom, Alpha)
  1467. if S.GuiScope then
  1468. Scope.BackgroundTransparency = NumLerp(CurrentTrans, 0, Alpha)
  1469. end
  1470. if X == 90 then break end
  1471. RS:wait()
  1472. end
  1473. else
  1474. LWeld.C0, LWeld.C1 = ArmC0[1], S.ArmC1_Aimed.Left
  1475. RWeld.C0, RWeld.C1 = ArmC0[2], S.ArmC1_Aimed.Right
  1476. AnimWeld.C0 = CF(0, 1, 0)
  1477. Grip.C1 = Aimed_GripCF
  1478. LWeld2.C1, RWeld2.C1 = CF(), CF()
  1479. Camera.FieldOfView = S.MaxZoom
  1480. end
  1481. Aiming = (not Aimed)
  1482. if (not Aiming) and S.GuiScope then
  1483. spawn(function()
  1484. Steady.Visible = true
  1485. Scope.BackgroundTransparency = 1
  1486. Scope.ImageTransparency = 0
  1487.  
  1488. local Gun_Model = Instance.new("Model")
  1489. Gun_Model.Name = "Gun_Model"
  1490. for _, Obj in pairs(Gun:GetChildren()) do
  1491. if Obj:IsA("BasePart") then
  1492. local ObjClone = Obj:Clone()
  1493. ObjClone.Parent = Gun_Model
  1494.  
  1495. local W = Instance.new("Weld")
  1496. W.Part0 = ObjClone
  1497. W.Part1 = Obj
  1498. W.Parent = ObjClone
  1499.  
  1500. local PrevTrans = Instance.new("NumberValue")
  1501. PrevTrans.Name = "PrevTrans"
  1502. PrevTrans.Value = Obj.Transparency
  1503. PrevTrans.Parent = Obj
  1504.  
  1505. Obj.Transparency = 1
  1506. end
  1507. end
  1508. Gun_Model.Parent = Character
  1509. end)
  1510. spawn(function()
  1511. while Aimed do
  1512. local Ang = (CameraSteady and 0 or (Idleing and AnimAng[2] or AnimAng[4]))
  1513. if CameraSway ~= 0 then
  1514. local OffsetX, OffsetY = 0, 0
  1515. if Idleing then
  1516. OffsetX = (RAD(COS(Ang * 5 * (CameraSway ^ 0.4))) / 40) * (CameraSway ^ 1.2) * StanceSway * S.ScopeSway
  1517. OffsetY = (RAD(COS(Ang * 2 * (CameraSway ^ 0.4))) / 40) * (CameraSway ^ 1.2) * StanceSway * S.ScopeSway
  1518. else
  1519. OffsetX = (RAD(COS(Ang * 3/2 * (CameraSway ^ 0.4))) / 25) * (CameraSway ^ 1.2) * StanceSway * S.ScopeSway
  1520. OffsetY = (RAD(COS(Ang * 3/5 * (CameraSway ^ 0.4))) / 25) * (CameraSway ^ 1.2) * StanceSway * S.ScopeSway
  1521. end
  1522. RotCamera(OffsetX, OffsetY)
  1523. end
  1524. RS:wait()
  1525. end
  1526. end)
  1527. end
  1528. end
  1529.  
  1530. function UnAimGun(Exception)
  1531. local Scope = Gui_Clone:WaitForChild("Scope"):WaitForChild("Img")
  1532. local Steady = Gui_Clone:WaitForChild("Scope"):WaitForChild("Steady")
  1533. if (not Exception) then
  1534. if (not Aimed) then return end
  1535. if (Reloading and Exception) or Knifing and (not ThrowingGrenade) then return end
  1536. CurrentRecoil = S.Recoil.Hipfire
  1537. CurrentSpread = ((Idleing and (not Walking)) and S.Spread.Hipfire or S.Spread.Walking)
  1538. if Walking and Aimed then
  1539. Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
  1540. UDim2.new(0, 150, 0, 150),
  1541. UDim2.new(0, -75, 0, -75),
  1542. Enum.EasingDirection.Out,
  1543. Enum.EasingStyle.Linear,
  1544. S.AimAnimation and S.AimSpeed or 0,
  1545. true
  1546. )
  1547. elseif Idleing then
  1548. Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
  1549. UDim2.new(0, 70, 0, 70),
  1550. UDim2.new(0, -35, 0, -35),
  1551. Enum.EasingDirection.Out,
  1552. Enum.EasingStyle.Linear,
  1553. S.AimAnimation and S.AimSpeed or 0,
  1554. true
  1555. )
  1556. end
  1557. Aimed = false
  1558. Aiming = true
  1559. if S.GuiScope then
  1560. spawn(function()
  1561. local Gun_Model = Character:FindFirstChild("Gun_Model")
  1562. if Gun_Model then
  1563. Gun_Model:Destroy()
  1564. end
  1565.  
  1566. for _, Obj in pairs(Gun:GetChildren()) do
  1567. if Obj:IsA("BasePart") then
  1568. local PrevTrans = Obj:FindFirstChild("PrevTrans")
  1569.  
  1570. Obj.Transparency = PrevTrans.Value
  1571. PrevTrans:Destroy()
  1572. end
  1573. end
  1574. end)
  1575. end
  1576. if S.AimAnimation then
  1577. local CurrentFOV = Camera.FieldOfView
  1578. local CurrentCameraOffset = Humanoid.CameraOffset
  1579. local CurrentTrans = (Scope.BackgroundTransparency == 1 and (S.GuiScope and 0 or 1) or Scope.BackgroundTransparency)
  1580. Scope.ImageTransparency = 1
  1581. Steady.Visible = false
  1582. TweenJoint(LWeld, ArmC0[1], S.ArmC1_UnAimed.Left, Sine, S.AimSpeed)
  1583. TweenJoint(RWeld, ArmC0[2], S.ArmC1_UnAimed.Right, Sine, S.AimSpeed)
  1584. TweenJoint(Grip, Grip.C0, CFANG(0, RAD(20), 0), Sine, S.AimSpeed)
  1585. if S.PlayerAnimations then
  1586. TweenJoint(LWeld2, CF(), CFANG(0, RAD(ArmTilt), 0), Sine, S.AimSpeed)
  1587. TweenJoint(RWeld2, CF(), CFANG(0, RAD(ArmTilt), 0), Sine, S.AimSpeed)
  1588. end
  1589. local X = 0
  1590. while true do
  1591. local NewX = X + 1.5 / S.AimSpeed
  1592. X = (NewX > 90 and 90 or NewX)
  1593. if Aimed then break end
  1594. if (not Selected) then break end
  1595. local Alpha = 1 - COS(RAD(X))
  1596. Camera.FieldOfView = NumLerp(CurrentFOV, 90, Alpha)
  1597. Scope.BackgroundTransparency = NumLerp(CurrentTrans, 1, Alpha)
  1598. if X == 90 then break end
  1599. RS:wait()
  1600. end
  1601. else
  1602. Scope.BackgroundTransparency = 1
  1603. Scope.ImageTransparency = 1
  1604. Steady.Visible = false
  1605. LWeld.C0, LWeld.C1 = ArmC0[1], S.ArmC1_UnAimed.Left
  1606. RWeld.C0, RWeld.C1 = ArmC0[2], S.ArmC1_UnAimed.Right
  1607. Grip.C1 = CFANG(0, RAD(20), 0)
  1608. LWeld2.C1, RWeld2.C1 = CFANG(0, RAD(ArmTilt), 0), CFANG(0, RAD(ArmTilt), 0)
  1609. Camera.FieldOfView = 90
  1610. end
  1611. Aiming = Aimed
  1612. else
  1613. if S.GuiScope then
  1614. spawn(function()
  1615. local Gun_Model = Character:FindFirstChild("Gun_Model")
  1616. if Gun_Model then
  1617. Gun_Model:Destroy()
  1618. end
  1619.  
  1620. for _, Obj in pairs(Gun:GetChildren()) do
  1621. if Obj:IsA("BasePart") then
  1622. local PrevTrans = Obj:FindFirstChild("PrevTrans")
  1623.  
  1624. Obj.Transparency = PrevTrans.Value
  1625. PrevTrans:Destroy()
  1626. end
  1627. end
  1628. end)
  1629. end
  1630. spawn(function()
  1631. Aimed = false
  1632. Aiming = false
  1633. CurrentRecoil = S.Recoil.Hipfire
  1634. CurrentSpread = ((Idleing and (not Walking)) and S.Spread.Hipfire or S.Spread.Walking)
  1635. if (not Walking) then
  1636. Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
  1637. UDim2.new(0, 70, 0, 70),
  1638. UDim2.new(0, -35, 0, -35),
  1639. Enum.EasingDirection.Out,
  1640. Enum.EasingStyle.Linear,
  1641. S.AimAnimation and S.AimSpeed or 0,
  1642. true
  1643. )
  1644. else
  1645. Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
  1646. UDim2.new(0, 150, 0, 150),
  1647. UDim2.new(0, -75, 0, -75),
  1648. Enum.EasingDirection.Out,
  1649. Enum.EasingStyle.Linear,
  1650. S.AimAnimation and S.AimSpeed or 0,
  1651. true
  1652. )
  1653. end
  1654. local CurrentFOV = Camera.FieldOfView
  1655. local CurrentCameraOffset = Humanoid.CameraOffset
  1656. local CurrentTrans = (Scope.BackgroundTransparency == 1 and (S.GuiScope and 0 or 1) or Scope.BackgroundTransparency)
  1657. Scope.ImageTransparency = 1
  1658. Steady.Visible = false
  1659. if LWeld:FindFirstChild("TweenCode") then LWeld.TweenCode:Destroy() end
  1660. if RWeld:FindFirstChild("TweenCode") then RWeld.TweenCode:Destroy() end
  1661. if Grip:FindFirstChild("TweenCode") then Grip.TweenCode:Destroy() end
  1662. if LWeld2:FindFirstChild("TweenCode") then LWeld2.TweenCode:Destroy() end
  1663. if RWeld2:FindFirstChild("TweenCode") then RWeld2.TweenCode:Destroy() end
  1664. if S.AimAnimation then
  1665. local X = 0
  1666. while true do
  1667. local NewX = X + 1.5 / S.AimSpeed
  1668. X = (NewX > 90 and 90 or NewX)
  1669. if Aimed then break end
  1670. if (not Selected) then break end
  1671. local Alpha = 1 - COS(RAD(X))
  1672. Camera.FieldOfView = NumLerp(CurrentFOV, 90, Alpha)
  1673. Scope.BackgroundTransparency = NumLerp(CurrentTrans, 1, Alpha)
  1674. if X == 90 then break end
  1675. RS:wait()
  1676. end
  1677. else
  1678. Scope.BackgroundTransparency = 1
  1679. Scope.ImageTransparency = 1
  1680. Steady.Visible = false
  1681. Camera.FieldOfView = 90
  1682. end
  1683. end)
  1684. end
  1685. end
  1686.  
  1687. --------------------[ TEXTURE CREATION FUNCTIONS ]------------------------------------
  1688.  
  1689. function CreateBullet(Direction)
  1690. local Origin = Gun.Main.CFrame.p
  1691. local BulletMass = S.BulletSize.X * S.BulletSize.Y * S.BulletSize.Z
  1692. local BulletCF = CF(Origin, Origin + Direction)
  1693. local Bullet = Instance.new("Part")
  1694. Bullet.BrickColor = S.BulletColor
  1695. Bullet.Name = "Bullet"
  1696. Bullet.CanCollide = false
  1697. Bullet.FormFactor = "Custom"
  1698. Bullet.Size = S.BulletSize
  1699. Bullet.BottomSurface = "Smooth"
  1700. Bullet.TopSurface = "Smooth"
  1701. local Mesh = Instance.new("BlockMesh")
  1702. Mesh.Scale = S.BulletMeshSize
  1703. Mesh.Parent = Bullet
  1704. local BF = Instance.new("BodyForce")
  1705. BF.force = VEC3(0, BulletMass * (196.2 - S.BulletDropPerSecond), 0)
  1706. BF.Parent = Bullet
  1707. Bullet.Parent = Gun_Ignore
  1708. Bullet.CFrame = BulletCF + Direction * 3
  1709. Bullet.Velocity = Direction * S.BulletVelocity
  1710. return Bullet
  1711. end
  1712.  
  1713. function CreateBulletHole(HitPos, HitObj)
  1714. local SurfaceCF = GetHitSurfaceCFrame(HitPos, HitObj)
  1715. local SurfaceDir = CF(HitObj.CFrame.p, SurfaceCF.p)
  1716. local SurfaceDist = SurfaceDir.lookVector * (HitObj.CFrame.p - SurfaceCF.p).magnitude / 2
  1717. local SurfaceOffset = HitPos - SurfaceCF.p + SurfaceDist
  1718. local SurfaceCFrame = SurfaceDir + SurfaceDist + SurfaceOffset
  1719. local HitMark = Instance.new("Part")
  1720. HitMark.BrickColor = BrickColor.new("Black")
  1721. HitMark.Transparency = 1
  1722. HitMark.Anchored = true
  1723. HitMark.CanCollide = false
  1724. HitMark.FormFactor = "Custom"
  1725. HitMark.Size = VEC3(1, 1, 0.2)
  1726. HitMark.TopSurface = 0
  1727. HitMark.BottomSurface = 0
  1728. local Mesh = Instance.new("BlockMesh")
  1729. Mesh.Offset = VEC3(0, 0, -0.05)
  1730. Mesh.Scale = VEC3(S.BulletHoleSize, S.BulletHoleSize, 0)
  1731. Mesh.Parent = HitMark
  1732. local Decal = Instance.new("Decal")
  1733. Decal.Face = Enum.NormalId.Front
  1734. Decal.Texture = S.BulletHoleTexture
  1735. Decal.Parent = HitMark
  1736. HitMark.Parent = Gun_Ignore
  1737. HitMark.CFrame = SurfaceCFrame
  1738. if (not HitObj.Anchored) then
  1739. local Weld = Instance.new("Weld", HitMark)
  1740. Weld.Part0 = HitObj
  1741. Weld.Part1 = HitMark
  1742. Weld.C0 = HitObj.CFrame:toObjectSpace(SurfaceCFrame)
  1743. HitMark.Anchored = false
  1744. end
  1745. delay(S.BulletHoleVisibleTime, function()
  1746. if S.BulletHoleDisappearTime > 0 then
  1747. local X = 0
  1748. while true do
  1749. if X == 90 then break end
  1750. if (not Selected) then break end
  1751. local NewX = X + (1.5 / S.BulletHoleDisappearTime)
  1752. X = (NewX > 90 and 90 or NewX)
  1753. local Alpha = X / 90
  1754. Decal.Transparency = NumLerp(0, 1, Alpha)
  1755. RS:wait()
  1756. end
  1757. HitMark:Destroy()
  1758. else
  1759. HitMark:Destroy()
  1760. end
  1761. end)
  1762. end
  1763.  
  1764. function CreateShockwave(Center, Radius)
  1765. local Shockwave = Instance.new("Part")
  1766. Shockwave.BrickColor = S.ShockwaveColor
  1767. Shockwave.Material = Enum.Material.SmoothPlastic
  1768. Shockwave.Name = "Shockwave"
  1769. Shockwave.Anchored = true
  1770. Shockwave.CanCollide = false
  1771. Shockwave.FormFactor = Enum.FormFactor.Symmetric
  1772. Shockwave.Size = VEC3(1, 1, 1)
  1773. Shockwave.BottomSurface = Enum.SurfaceType.Smooth
  1774. Shockwave.TopSurface = Enum.SurfaceType.Smooth
  1775. local Mesh = Instance.new("SpecialMesh")
  1776. Mesh.MeshType = Enum.MeshType.Sphere
  1777. Mesh.Scale = VEC3()
  1778. Mesh.Parent = Shockwave
  1779. Shockwave.Parent = Gun_Ignore
  1780. Shockwave.CFrame = CF(Center)
  1781. spawn(function()
  1782. for i = 0, 1, (1 / (60 * S.ShockwaveDuration)) do
  1783. local Scale = 2 * Radius * i
  1784. Mesh.Scale = VEC3(Scale, Scale, Scale)
  1785. Shockwave.Transparency = i
  1786. RS:wait()
  1787. end
  1788. Shockwave:Destroy()
  1789. end)
  1790. end
  1791.  
  1792. --------------------[ HIT HANDLING FUNCTIONS ]----------------------------------------
  1793.  
  1794. function Damage(HitObj, HitPos)
  1795. local HeadVal = S.Multipliers.Head
  1796. local ChestVal = S.Multipliers.Chest
  1797. local LimbsVal = S.Multipliers.Limbs
  1798. if Humanoid.Health ~= 0 then
  1799. if HitObj and HitObj.Parent then
  1800. local HumanoidFound = false
  1801. local HitHumanoid = nil
  1802. if HitObj.Parent.ClassName == "Hat" then
  1803. if FindFirstClass(HitObj.Parent.Parent, "Humanoid") then
  1804. HitHumanoid = FindFirstClass(HitObj.Parent.Parent, "Humanoid")
  1805. HumanoidFound = true
  1806. if HitHumanoid.Health > 0 then
  1807. if IsEnemy(HitHumanoid) then
  1808. local CreatorTag = Instance.new("ObjectValue")
  1809. CreatorTag.Value = Player
  1810. CreatorTag.Name = "creator"
  1811. CreatorTag.Parent = HitHumanoid
  1812. HitHumanoid:TakeDamage(S.Damage * RAND(HeadVal, HeadVal + 0.1, 0.01))
  1813. MarkHit()
  1814. end
  1815. end
  1816. end
  1817. else
  1818. if FindFirstClass(HitObj.Parent, "Humanoid") then
  1819. HitHumanoid = FindFirstClass(HitObj.Parent, "Humanoid")
  1820. HumanoidFound = true
  1821. if HitHumanoid.Health > 0 then
  1822. if IsEnemy(HitHumanoid) then
  1823. local CreatorTag = Instance.new("ObjectValue")
  1824. CreatorTag.Value = Player
  1825. CreatorTag.Name = "creator"
  1826. CreatorTag.Parent = HitHumanoid
  1827. local ChosenDamage = 0
  1828. if HitObj.Name == "Head" then
  1829. ChosenDamage = S.Damage * RAND(HeadVal, HeadVal + 0.1, 0.01)
  1830. elseif HitObj.Name == "Torso" then
  1831. ChosenDamage = S.Damage * RAND(ChestVal, ChestVal + 0.1, 0.01)
  1832. else
  1833. ChosenDamage = S.Damage * RAND(LimbsVal, LimbsVal + 0.1, 0.01)
  1834. end
  1835. HitHumanoid:TakeDamage(ChosenDamage)
  1836. MarkHit()
  1837. end
  1838. end
  1839. end
  1840. end
  1841. if (not HumanoidFound) then
  1842. if S.BulletHoles then
  1843. CreateBulletHole(HitPos, HitObj)
  1844. end
  1845. if S.Shockwaves then
  1846. CreateShockwave(HitPos, S.ShockwaveRadius)
  1847. end
  1848. end
  1849. return HitHumanoid
  1850. end
  1851. end
  1852. end
  1853.  
  1854. function PenetrateWall(HitPos, Direction, HitHumanoid, OriginPos, Bullet)
  1855. local HitDist = (HitPos - OriginPos).magnitude
  1856. local Thickness, Wall, WallHitPos = 0, nil, nil
  1857. for i = 0.1, S.Penetration, 0.1 do
  1858. local WallRay = Ray.new(HitPos + (Direction * i), -Direction)
  1859. local TempWall, TempWallHitPos = game.Workspace:FindPartOnRayWithIgnoreList(WallRay, Ignore)
  1860. if TempWall then
  1861. Thickness = i
  1862. Wall, WallHitPos = TempWall, TempWallHitPos
  1863. break
  1864. end
  1865. end
  1866. if Wall then
  1867. CreateBulletHole(WallHitPos, Wall)
  1868. if S.InstantHit then
  1869. local HitObj2, HitPos2 = nil, nil
  1870. if HitHumanoid then
  1871. HitObj2, HitPos2 = AdvRayCast(WallHitPos, Direction, S.BulletRange - HitDist, {HitHumanoid.Parent,unpack(Ignore)})
  1872. else
  1873. HitObj2, HitPos2 = AdvRayCast(WallHitPos, Direction, S.BulletRange - HitDist)
  1874. end
  1875. Damage(HitObj2, HitPos2)
  1876. return HitPos2
  1877. else
  1878. local LastPos = WallHitPos
  1879. local TotalDistTraveled = 0
  1880. spawn(function()
  1881. while true do
  1882. RS:wait()
  1883. if TotalDistTraveled >= S.BulletRange - HitDist then
  1884. Bullet:Destroy()
  1885. break
  1886. end
  1887. local DistTraveled = (Bullet.Position - LastPos).magnitude
  1888. local NewDirection = (Bullet.Position - LastPos).unit
  1889. local TempHitObj, TempHitPos = nil, nil
  1890. if HitHumanoid then
  1891. TempHitObj, TempHitPos = AdvRayCast(LastPos, NewDirection, DistTraveled, {HitHumanoid.Parent,unpack(Ignore)})
  1892. else
  1893. TempHitObj, TempHitPos = AdvRayCast(LastPos, NewDirection, DistTraveled)
  1894. end
  1895. if TempHitObj then
  1896. Damage(TempHitObj, TempHitPos)
  1897. Bullet:Destroy()
  1898. return TempHitPos
  1899. else
  1900. LastPos = Bullet.Position
  1901. TotalDistTraveled = TotalDistTraveled + DistTraveled
  1902. end
  1903. end
  1904. end)
  1905. end
  1906. else
  1907. if Bullet then Bullet:Destroy() end
  1908. return HitPos
  1909. end
  1910. end
  1911.  
  1912. function IsEnemy(Human)
  1913. local Plyr = game.Players:GetPlayerFromCharacter(Human.Parent)
  1914. if (not Plyr) then return S.CanDamageNPCs end
  1915. return S.AllowFriendlyFire or (Plyr.TeamColor ~= Player.TeamColor or Plyr.Neutral)
  1916. end
  1917.  
  1918. --------------------[ RELOAD FUNCTIONS ]----------------------------------------------
  1919.  
  1920. function ReloadAnim()
  1921. TweenJoint(LWeld2, CF(), CF(), Sine, 0.15)
  1922. TweenJoint(RWeld2, CF(), CF(), Sine, 0.15)
  1923. local Speed = S.ReloadTime / 2
  1924. local Mag_Parts = {}
  1925.  
  1926. for _, Obj in pairs(Gun:GetChildren()) do
  1927. if Obj.Name == "Mag" and Obj:IsA("BasePart") then
  1928. INSERT(Mag_Parts, {Original = Obj, Clone1 = Obj:Clone(), Clone2 = Obj:Clone()})
  1929. end
  1930. end
  1931.  
  1932. local W1 = nil
  1933. local W2 = nil
  1934.  
  1935. local SequenceTable = {
  1936.  
  1937. function()
  1938.  
  1939. for Index, Mag in pairs(Mag_Parts) do
  1940. Mag.Original.Transparency = 1
  1941. Mag.Clone1.Parent = Gun_Ignore
  1942. Mag.Clone1.CanCollide = true
  1943.  
  1944. if Index ~= 1 then
  1945. local W = Instance.new("Weld")
  1946. W.Part0 = Mag_Parts[1].Clone1
  1947. W.Part1 = Mag.Clone1
  1948. W.C0 = Mag_Parts[1].Clone1.CFrame:toObjectSpace(Mag.Clone1.CFrame)
  1949. W.Parent = Mag_Parts[1].Clone1
  1950. end
  1951. end
  1952.  
  1953. W1 = Instance.new("Weld")
  1954. W1.Part0 = Mag_Parts[1].Clone1
  1955. W1.Part1 = Handle
  1956. W1.C0 = Mag_Parts[1].Original.CFrame:toObjectSpace(Handle.CFrame)
  1957. W1.Parent = Mag_Parts[1].Clone1
  1958.  
  1959. TweenJoint(LWeld, ArmC0[1], CF(0, 0.61, 0) * CFANG(RAD(70), 0, 0), Linear, 0.5 * Speed)
  1960. TweenJoint(RWeld, ArmC0[2], CF(0.4, 0.09, -0.21) * CFANG(RAD(20), RAD(3), 0), Linear, 0.35 * Speed)
  1961. TweenJoint(Grip, Grip.C0, CFANG(0, RAD(10), 0), Linear, 0.5 * Speed)
  1962. wait(0.3 * Speed)
  1963.  
  1964. end;
  1965.  
  1966. function()
  1967.  
  1968. TweenJoint(RWeld, ArmC0[2], CF(0.4, -0.01, -0.31) * CFANG(RAD(-22), RAD(3), 0), Sine, 0.3 * Speed)
  1969. wait(0.2 * Speed)
  1970.  
  1971. end;
  1972.  
  1973. function()
  1974.  
  1975. W1:Destroy()
  1976. Mag_Parts[1].Clone1.Velocity = Handle.Velocity + Handle.CFrame:vectorToWorldSpace(VEC3(0,-5,0)) * 20
  1977. spawn(function()
  1978. while Mag_Parts[1].Clone1.Velocity.magnitude > 0.1 do wait() end
  1979. for _, Mag in pairs(Mag_Parts) do
  1980. Mag.Clone1.Anchored = true
  1981. Mag.Clone1:BreakJoints()
  1982. end
  1983. end)
  1984.  
  1985. for Index, Mag in pairs(Mag_Parts) do
  1986. Mag.Clone2.Parent = Gun_Ignore
  1987.  
  1988. if Index ~= 1 then
  1989. local W = Instance.new("Weld")
  1990. W.Part0 = Mag_Parts[1].Clone2
  1991. W.Part1 = Mag.Clone2
  1992. W.C0 = Mag_Parts[1].Clone2.CFrame:toObjectSpace(Mag.Clone2.CFrame)
  1993. W.Parent = Mag_Parts[1].Clone2
  1994. end
  1995. end
  1996.  
  1997. W2 = Instance.new("Weld")
  1998. W2.Part0 = FakeLArm
  1999. W2.Part1 = Mag_Parts[1].Clone2
  2000. W2.C0 = CF(0, -1, 0) * CFANG(RAD(-90), 0, 0)
  2001. W2.Parent = FakeLArm
  2002. wait(0.1)
  2003.  
  2004. end;
  2005.  
  2006. function()
  2007.  
  2008. local FakeLArmCF = LWeld.Part0.CFrame * ArmC0[1] * (CF(0.3, 1.9, -0.31) * CFANG(RAD(-20), RAD(30), RAD(-60))):inverse()
  2009. local FakeRArmCF = RWeld.Part0.CFrame * ArmC0[2] * (CF(0.4, -0.1, -0.21) * CFANG(RAD(-20), RAD(5), RAD(10))):inverse()
  2010. local HandleCF = FakeRArm.CFrame:toObjectSpace(Grip.Part0.CFrame * Grip.C0)
  2011. local Mag_Original_CF = Handle.CFrame:toObjectSpace(Mag_Parts[1].Original.CFrame)
  2012. local MagC0 = FakeLArmCF:toObjectSpace(FakeRArmCF * HandleCF * Mag_Original_CF)
  2013.  
  2014. TweenJoint(LWeld, ArmC0[1], CF(-0.3, 1.85, -0.11) * CFANG(RAD(-10), RAD(30), RAD(-60)), Sine, 0.6 * Speed)
  2015. TweenJoint(RWeld, ArmC0[2], CF(0.4, -0.1, -0.21) * CFANG(RAD(-20), RAD(5), RAD(10)), Sine, 0.6 * Speed)
  2016. TweenJoint(Grip, Grip.C0, CF(), Sine, 0.6 * Speed)
  2017. TweenJoint(W2, MagC0, CF(), Sine, 0.6 * Speed)
  2018. wait(0.7 * Speed)
  2019.  
  2020. end;
  2021.  
  2022. function()
  2023.  
  2024. for _, Mag in pairs(Mag_Parts) do
  2025. Mag.Original.Transparency = 0
  2026. Mag.Clone2:Destroy()
  2027. end
  2028.  
  2029. TweenJoint(LWeld, ArmC0[1], S.ArmC1_UnAimed.Left, Sine, 0.5 * Speed)
  2030. TweenJoint(RWeld, ArmC0[2], S.ArmC1_UnAimed.Right, Sine, 0.5 * Speed)
  2031. TweenJoint(Grip, Grip.C0, CFANG(0, RAD(20), 0), Sine, 0.5 * Speed)
  2032. wait(0.5 * Speed)
  2033.  
  2034. end;
  2035.  
  2036. }
  2037.  
  2038. for _,ReloadFunction in pairs(SequenceTable) do
  2039. if BreakReload then
  2040. break
  2041. end
  2042. ReloadFunction()
  2043. end
  2044.  
  2045. if W1 then W1:Destroy() end
  2046. if W2 then W2:Destroy() end
  2047. for _, Mag in pairs(Mag_Parts) do
  2048. Mag.Clone1:Destroy()
  2049. Mag.Clone2:Destroy()
  2050. end
  2051. end
  2052.  
  2053. function Reload()
  2054. Running = false
  2055. if Ammo.Value < ClipSize.Value and (not Reloading) and StoredAmmo.Value > 0 then
  2056. AmmoInClip = (AmmoInClip == 0 and Ammo.Value or AmmoInClip)
  2057. Ammo.Value = 0
  2058. Reloading = true
  2059. if Aimed then UnAimGun(S.ReloadAnimation) end
  2060. Gui_Clone.CrossHair.Reload.Visible = true
  2061. if Handle:FindFirstChild("ReloadSound") then Handle.ReloadSound:Play() end
  2062. if S.ReloadAnimation then
  2063. wait()
  2064. ReloadAnim()
  2065. else
  2066. local StartReload = tick()
  2067. while true do
  2068. if BreakReload then break end
  2069. if (tick() - StartReload) >= S.ReloadTime then break end
  2070. RS:wait()
  2071. end
  2072. end
  2073. if (not BreakReload) then
  2074. if StoredAmmo.Value >= ClipSize.Value then
  2075. Ammo.Value = ClipSize.Value
  2076. if AmmoInClip > 0 then
  2077. StoredAmmo.Value = StoredAmmo.Value - (ClipSize.Value - AmmoInClip)
  2078. else
  2079. StoredAmmo.Value = StoredAmmo.Value - ClipSize.Value
  2080. end
  2081. elseif StoredAmmo.Value < ClipSize.Value and StoredAmmo.Value > 0 then
  2082. Ammo.Value = StoredAmmo.Value
  2083. StoredAmmo.Value = 0
  2084. end
  2085. end
  2086. BreakReload = false
  2087. Reloading = false
  2088. if Selected then
  2089. AmmoInClip = 0
  2090. Gui_Clone.CrossHair.Reload.Visible = false
  2091. end
  2092. end
  2093. end
  2094.  
  2095. --------------------[ EXTERNAL DATA LOCATING FUNCTIONS ]-----------------------------
  2096.  
  2097. function FindFirstClass(Object, Class)
  2098. local FoundObject = nil
  2099. for _, Obj in pairs(Object:GetChildren()) do
  2100. if Obj.ClassName == Class then
  2101. FoundObject = Obj
  2102. break
  2103. end
  2104. end
  2105. return FoundObject
  2106. end
  2107.  
  2108. function IsIgnored(Obj)
  2109. for _,v in pairs(Ignore) do
  2110. if Obj == v or Obj:IsDescendantOf(v) then
  2111. return true
  2112. end
  2113. end
  2114. return false
  2115. end
  2116.  
  2117. function GetHitSurfaceCFrame(HitPos,Obj)
  2118. local SurfaceCF = {
  2119. {"Back",Obj.CFrame * CF(0,0,Obj.Size.z)};
  2120. {"Bottom",Obj.CFrame * CF(0,-Obj.Size.y,0)};
  2121. {"Front",Obj.CFrame * CF(0,0,-Obj.Size.z)};
  2122. {"Left",Obj.CFrame * CF(-Obj.Size.x,0,0)};
  2123. {"Right",Obj.CFrame * CF(Obj.Size.x,0,0)};
  2124. {"Top",Obj.CFrame * CF(0,Obj.Size.y,0)}
  2125. }
  2126. local ClosestDist = HUGE
  2127. local ClosestSurface = nil
  2128. for _,v in pairs(SurfaceCF) do
  2129. local SurfaceDist = (HitPos - v[2].p).magnitude
  2130. if SurfaceDist < ClosestDist then
  2131. ClosestDist = SurfaceDist
  2132. ClosestSurface = v
  2133. end
  2134. end
  2135. return ClosestSurface[2]
  2136. end
  2137.  
  2138. function AdvRayCast(Origin, Direction, Dist, CustomIgnore)
  2139. local NewIgnore = (CustomIgnore and CustomIgnore or Ignore)
  2140. local NewRay = Ray.new(Origin, Direction * (Dist > 999 and 999 or Dist))
  2141. local HitObj, HitPos = game.Workspace:FindPartOnRayWithIgnoreList(NewRay, NewIgnore)
  2142. local LastPos = HitPos
  2143. local FinalHitObj, FinalHitPos = nil, nil
  2144. local RepTimes = math.floor(Dist / 999)
  2145. if (not HitObj) and (Dist > 999) then
  2146. for i = 0, RepTimes do
  2147. local NewDist = (i == RepTimes and (Dist - (LastPos - Origin).magnitude) or 999)
  2148. local Ray2 = Ray.new(LastPos, Direction * NewDist)
  2149. local HitObj2, HitPos2 = game.Workspace:FindPartOnRayWithIgnoreList(Ray2, NewIgnore)
  2150. if i ~= RepTimes then
  2151. if HitObj2 then
  2152. FinalHitObj, FinalHitPos = HitObj2, HitPos2
  2153. break
  2154. end
  2155. elseif i == RepTimes then
  2156. FinalHitObj, FinalHitPos = HitObj2, HitPos2
  2157. end
  2158. LastPos = HitPos2
  2159. end
  2160. return FinalHitObj, FinalHitPos
  2161. elseif HitObj or (Dist <= 999) then
  2162. return HitObj, HitPos
  2163. end
  2164. end
  2165.  
  2166. --------------------[ KNIFING FUNCTION ]----------------------------------------------
  2167.  
  2168. function KnifeAnim()
  2169. local Connection = nil
  2170. local Blade = Instance.new("Part")
  2171. Blade.BrickColor = BrickColor.new("Really black")
  2172. Blade.Name = "Blade"
  2173. Blade.CanCollide = false
  2174. Blade.FormFactor = Enum.FormFactor.Custom
  2175. Blade.Size = VEC3(0.5, 2.5, 1)
  2176. local Mesh = Instance.new("SpecialMesh")
  2177. Mesh.MeshId = 121944778
  2178. Mesh.MeshType = Enum.MeshType.FileMesh
  2179. Mesh.Scale = VEC3(0.7, 0.7, 0.7)
  2180. Mesh.TextureId = 121944805
  2181. Mesh.Parent = Blade
  2182. Blade.Parent = Gun_Ignore
  2183. local BladeWeld = Instance.new("Weld")
  2184. BladeWeld.Part0 = Blade
  2185. BladeWeld.Part1 = FakeLArm
  2186. BladeWeld.C0 = CFANG(RAD(-90), 0, RAD(180))
  2187. BladeWeld.C1 = CF(0, -1, 0.75)
  2188. BladeWeld.Parent = Blade
  2189. Connection = Blade.Touched:connect(function(Obj)
  2190. if Obj then
  2191. local HitHumanoid = FindFirstClass(Obj.Parent, "Humanoid")
  2192. if HitHumanoid and IsEnemy(HitHumanoid) then
  2193. local CreatorTag = Instance.new("ObjectValue")
  2194. CreatorTag.Name = "creator"
  2195. CreatorTag.Value = Player
  2196. CreatorTag.Parent = HitHumanoid
  2197. HitHumanoid:TakeDamage(HitHumanoid.MaxHealth)
  2198. MarkHit()
  2199. end
  2200. end
  2201. end)
  2202. TweenJoint(LWeld2, CF(), CFANG(0, RAD(90), 0), Linear, 0.05)
  2203. TweenJoint(LWeld, ArmC0[1], CF(-0.1, 0.2, -0.1) * CFANG(0, 0, RAD(-20)), Linear, 0.05)
  2204. TweenJoint(RWeld, ArmC0[2], CFANG(RAD(-30), 0, 0), Linear, 0.1)
  2205. TweenJoint(Grip, Grip.C0, CF(), Linear, 0.1)
  2206. spawn(function()
  2207. local Force = HRP.CFrame.lookVector * 8e4
  2208. local BF = Instance.new("BodyForce")
  2209. BF.force = Force
  2210. BF.Parent = HRP
  2211. delay(0.03, function()
  2212. BF.force = -Force / 2
  2213. wait(0.03)
  2214. BF:Destroy()
  2215. end)
  2216. end)
  2217. wait(0.05)
  2218. RotCamera(RAD(6), 0, true, 0.1)
  2219. delay(0.1, function()
  2220. RotCamera(RAD(-2), 0, true, 0.05)
  2221. end)
  2222. TweenJoint(LWeld, ArmC0[1], CF(0.8, 1.7, 0.2) * CFANG(0, 0, RAD(-80)), Linear, 0.06)
  2223. wait(0.2)
  2224. Connection:disconnect()
  2225. wait(0.2)
  2226. TweenJoint(LWeld2, CF(), CF(), Linear, 0.15)
  2227. TweenJoint(LWeld, ArmC0[1], S.ArmC1_UnAimed.Left, Linear, 0.15)
  2228. TweenJoint(RWeld, ArmC0[2], S.ArmC1_UnAimed.Right, Linear, 0.15)
  2229. Blade:Destroy()
  2230. end
  2231.  
  2232. --------------------[ GRENADE FUNCTIONS ]---------------------------------------------
  2233.  
  2234. function CreateGrenade()
  2235. local Grenade = Instance.new("Model")
  2236.  
  2237. local Center = Instance.new("Part")
  2238. Center.BrickColor = S.GrenadeColor
  2239. Center.Name = "Center"
  2240. Center.CanCollide = false
  2241. Center.Elasticity = 0
  2242. Center.FormFactor = Enum.FormFactor.Custom
  2243. Center.Size = S.GrenadeSize
  2244. Center.BottomSurface = Enum.SurfaceType.Smooth
  2245. Center.TopSurface = Enum.SurfaceType.Smooth
  2246. Center.Parent = Grenade
  2247.  
  2248. local Mesh1 = Instance.new("SpecialMesh")
  2249. Mesh1.MeshType = Enum.MeshType.Sphere
  2250. Mesh1.Parent = Center
  2251.  
  2252. return Grenade
  2253. end
  2254.  
  2255. function CreateKnife()
  2256. local Knife = Instance.new("Part")
  2257. Knife.BrickColor = S.GrenadeColor
  2258. Knife.Name = "Knife"
  2259. Knife.CanCollide = false
  2260. Knife.FormFactor = Enum.FormFactor.Custom
  2261. Knife.Size = VEC3(1, 1, 3)
  2262.  
  2263. local Mesh = Instance.new("SpecialMesh")
  2264. Mesh.MeshId = "http://www.roblox.com/asset/?id=12221720"
  2265. Mesh.MeshType = Enum.MeshType.FileMesh
  2266. Mesh.Scale = VEC3(0.5, 0.5, 0.5)
  2267. Mesh.Parent = Knife
  2268.  
  2269. return Knife
  2270. end
  2271.  
  2272. function CreateTarget()
  2273. local Target = Instance.new("Model")
  2274.  
  2275. local Center = Instance.new("Part")
  2276. Center.BrickColor = BrickColor.new("Bright red")
  2277. Center.Material = Enum.Material.SmoothPlastic
  2278. Center.Transparency = 0.3
  2279. Center.Name = "Center"
  2280. Center.Anchored = true
  2281. Center.CanCollide = false
  2282. Center.FormFactor = Enum.FormFactor.Custom
  2283. Center.Size = VEC3(4, 0.2, 4)
  2284. Center.Parent = Target
  2285. local CylinderMesh = Instance.new("CylinderMesh")
  2286. CylinderMesh.Parent = Center
  2287.  
  2288. local Line = Instance.new("Part")
  2289. Line.BrickColor = BrickColor.new("Bright red")
  2290. Line.Transparency = 0.3
  2291. Line.Name = "Line"
  2292. Line.CFrame = Center.CFrame * CFrame.new(0, 5.1, 0)
  2293. Line.Anchored = true
  2294. Line.CanCollide = false
  2295. Line.FormFactor = Enum.FormFactor.Custom
  2296. Line.Size = VEC3(0.4, 10, 0.4)
  2297. Line.BottomSurface = Enum.SurfaceType.Smooth
  2298. Line.TopSurface = Enum.SurfaceType.Smooth
  2299. Line.Parent = Target
  2300.  
  2301. return Target
  2302. end
  2303.  
  2304. function DetonateExplosive(Grenade)
  2305. CreateShockwave(Grenade.Position, S.GrenadeBlastRadius)
  2306. local GrenadePos = Grenade.Position
  2307. local E = Instance.new("Explosion")
  2308. E.BlastPressure = S.GrenadeBlastPressure
  2309. E.BlastRadius = S.GrenadeBlastRadius
  2310. E.DestroyJointRadiusPercent = (S.GrenadeRangeBasedDamage and 0 or 1)
  2311. E.ExplosionType = S.GrenadeExplosionType
  2312. E.Position = GrenadePos
  2313. E.Hit:connect(function(HObj, HDist)
  2314. if HObj.Name == "Torso" and (not HObj:IsDescendantOf(Character)) then
  2315. if S.GrenadeRangeBasedDamage then
  2316. local ClosestPart = nil
  2317. local ClosestDist = math.huge
  2318.  
  2319. for _, P in pairs(HObj.Parent:GetChildren()) do
  2320. if P:IsA("BasePart") then
  2321. local Dist = (GrenadePos - P.Position).magnitude
  2322. if Dist < ClosestDist then
  2323. ClosestPart = P
  2324. ClosestDist = Dist
  2325. end
  2326. end
  2327. end
  2328.  
  2329. local Dir = (ClosestPart.Position - GrenadePos).unit
  2330. local H, P = AdvRayCast(GrenadePos, Dir, 999)
  2331. local RayHitHuman = H:IsDescendantOf(HObj.Parent)
  2332. if (S.GrenadeRayCastExplosions and RayHitHuman) or (not S.GrenadeRayCastExplosions) then
  2333. local HitHumanoid = FindFirstClass(HObj.Parent, "Humanoid")
  2334. if HitHumanoid and HitHumanoid.Health > 0 and IsEnemy(HitHumanoid) then
  2335. local DistFactor = ClosestDist / S.GrenadeBlastRadius
  2336. local DistInvert = math.max(1 - DistFactor,0)
  2337. local NewDamage = DistInvert * S.LethalGrenadeDamage
  2338.  
  2339. local CreatorTag = Instance.new("ObjectValue")
  2340. CreatorTag.Value = Player
  2341. CreatorTag.Name = "creator"
  2342. CreatorTag.Parent = HitHumanoid
  2343. HitHumanoid:TakeDamage(NewDamage)
  2344. MarkHit()
  2345. end
  2346. end
  2347. else
  2348. local HitHumanoid = FindFirstClass(HObj.Parent, "Humanoid")
  2349. if HitHumanoid and HitHumanoid.Health > 0 and IsEnemy(HitHumanoid) then
  2350. local CreatorTag = Instance.new("ObjectValue")
  2351. CreatorTag.Value = Player
  2352. CreatorTag.Name = "creator"
  2353. CreatorTag.Parent = HitHumanoid
  2354. MarkHit()
  2355. end
  2356. end
  2357. end
  2358. end)
  2359. E.Parent = game.Workspace
  2360.  
  2361. wait()
  2362.  
  2363. Grenade.Parent:Destroy()
  2364. end
  2365.  
  2366. function DetonateSmoke(Grenade)
  2367. CreateShockwave(Grenade.Position, S.GrenadeEffectRadius)
  2368. local GrenadePos = Grenade.Position
  2369.  
  2370. spawn(function()
  2371. for i = 1, math.floor(S.GrenadeEffectRadius / 5) + RAND(5, 10) do
  2372. local Size = RAND(S.GrenadeEffectRadius * 0.6, S.GrenadeEffectRadius * 0.8)
  2373. local Dist = RAND(0, S.GrenadeEffectRadius - Size)
  2374. local XRot, YRot = RAD(RAND(0, 180, 10)), RAD(RAND(0, 360, 10))
  2375. local RotLV = (CFANG(0, YRot, 0) * CFANG(XRot, 0, 0)).lookVector
  2376. local Pos = GrenadePos + (RotLV * VEC3(Dist, Dist / 2, Dist))
  2377.  
  2378. local Smoke = Instance.new("Part")
  2379. Smoke.Transparency = 1
  2380. Smoke.Name = "Smoke"
  2381. Smoke.Anchored = true
  2382. Smoke.CanCollide = false
  2383. Smoke.FormFactor = Enum.FormFactor.Symmetric
  2384. Smoke.Size = VEC3(1, 1, 1)
  2385. Smoke.TopSurface = Enum.SurfaceType.Smooth
  2386. Smoke.BottomSurface = Enum.SurfaceType.Smooth
  2387.  
  2388. local Mesh = Instance.new("SpecialMesh")
  2389. Mesh.MeshType = Enum.MeshType.Sphere
  2390. Mesh.Scale = VEC3(Size, Size, Size)
  2391. Mesh.Parent = Smoke
  2392.  
  2393. Smoke.Parent = Gun_Ignore
  2394. Smoke.CFrame = CF(Pos)
  2395.  
  2396. spawn(function()
  2397. local Trans = RAND(0.3, 0.5, 0.01)
  2398. for X = 0, 90, 2 do
  2399. Smoke.CFrame = CF(GrenadePos:lerp(Pos, Sine(X)))
  2400. Smoke.Transparency = NumLerp(1, Trans, Sine(X))
  2401. RS:wait()
  2402. end
  2403.  
  2404. wait(S.GrenadeEffectTime)
  2405.  
  2406. for X = 0, 90, 0.5 do
  2407. Smoke.CFrame = CF(Pos:lerp(Pos + VEC3(0, 20, 0), 1 - COS(RAD(X))))
  2408. Smoke.Transparency = NumLerp(Trans, 1, Sine(X))
  2409. RS:wait()
  2410. end
  2411.  
  2412. Smoke:Destroy()
  2413. end)
  2414.  
  2415. if i % 3 == 0 then
  2416. RS:wait()
  2417. end
  2418. end
  2419. end)
  2420.  
  2421. wait()
  2422.  
  2423. Grenade.Parent:Destroy()
  2424. end
  2425.  
  2426. function ThrowGrenade(Type)
  2427. local Grenade0 = nil
  2428. if S.TrajectoryAssist then
  2429. spawn(function()
  2430. local X = 0
  2431. local Vel = (Type == 1 and S.LethalGrenadeThrowVelocity or S.TacticalGrenadeThrowVelocity)
  2432.  
  2433. local GetX = function(Ang, T)
  2434. local Vx = Vel * math.cos(Ang)
  2435. return Vx * T
  2436. end
  2437.  
  2438. local GetY = function(Ang, T)
  2439. local V0y = Vel * math.sin(Ang)
  2440. local Vy = V0y + (-196.2 * T)
  2441. return (Vy * T) - (-98.1 * T * T)
  2442. end
  2443.  
  2444. local Target = CreateTarget()
  2445. Target.Parent = game.Workspace
  2446. Target.PrimaryPart = Target:WaitForChild("Center")
  2447.  
  2448. while (Keys[S.LethalGrenadeKey] or Keys[S.TacticalGrenadeKey]) and Selected do
  2449. X = X + math.rad(10)
  2450. for _,v in pairs(Target:GetChildren()) do
  2451. v.Transparency = 0.2 + ((math.sin(X) + 1) / 5)
  2452. end
  2453.  
  2454. local Lines = {}
  2455. local LastX, LastY = nil, nil
  2456. for T = 0, 10, 0.1 do
  2457. local XPos = GetX(math.rad(7) - HeadRot, T)
  2458. local YPos = GetY(math.rad(7) - HeadRot, T)
  2459. if LastX and LastY then
  2460. local LookV3 = HRP.CFrame.lookVector
  2461. local LastPos = (Head.CFrame * CF(1.5, 0, 0)).p + (LookV3 * LastX) + VEC3(0, LastY, 0)
  2462. local NewPos = (Head.CFrame * CF(1.5, 0, 0)).p + (LookV3 * XPos) + VEC3(0, YPos, 0)
  2463. local LineCF = CF(LastPos, NewPos)
  2464. local Dist = (LastPos - NewPos).magnitude
  2465. local NewDist = Dist
  2466.  
  2467. local H, P = AdvRayCast(LastPos, (NewPos - LastPos), 1, {Camera, unpack(Ignore)})
  2468. if H then
  2469. NewDist = (P - LastPos).magnitude
  2470.  
  2471. local SurfaceCF = GetHitSurfaceCFrame(P, H)
  2472. local SurfaceDir = CF(H.CFrame.p, SurfaceCF.p)
  2473. local SurfaceDist = SurfaceDir.lookVector * (H.CFrame.p - SurfaceCF.p).magnitude / 2
  2474. local SurfaceOffset = P - SurfaceCF.p + SurfaceDist
  2475. local SurfaceCFrame = SurfaceDir + SurfaceDist + SurfaceOffset
  2476.  
  2477. Target:SetPrimaryPartCFrame(SurfaceCFrame * CFANG(RAD(-90), 0, 0))
  2478.  
  2479. Target.Parent = Camera
  2480. else
  2481. Target.Parent = nil
  2482. end
  2483.  
  2484. local Line = Instance.new("Part")
  2485. Line.BrickColor = BrickColor.Red()
  2486. Line.Material = Enum.Material.SmoothPlastic
  2487. Line.Transparency = 0.2 + ((math.sin(X) + 1) / 5)
  2488. Line.Anchored = true
  2489. Line.CanCollide = false
  2490. Line.FormFactor = Enum.FormFactor.Custom
  2491. Line.Size = Vector3.new(0.4, 0.4, NewDist)
  2492. Line.TopSurface = Enum.SurfaceType.Smooth
  2493. Line.BottomSurface = Enum.SurfaceType.Smooth
  2494. Line.CFrame = LineCF + (LineCF.lookVector * NewDist / 2)
  2495. Line.Parent = Camera
  2496.  
  2497. table.insert(Lines, Line)
  2498.  
  2499. LastX,LastY = XPos,YPos
  2500.  
  2501. if H then break end
  2502. else
  2503. LastX,LastY = XPos,YPos
  2504. end
  2505. end
  2506.  
  2507. wait()
  2508.  
  2509. for _,Line in pairs(Lines) do
  2510. Line:Destroy()
  2511. end
  2512. end
  2513.  
  2514. Target:Destroy()
  2515. end)
  2516. end
  2517.  
  2518. local AnimTable = {
  2519. function()
  2520. TweenJoint(LWeld, CF(-1.5, 0, 0), CF(0, 0.6, 0), Linear, 0.2)
  2521. TweenJoint(RWeld, CF(1.5, 0, 0) * CFANG(0, 0, RAD(-10)), CF(0, 0.6, 0), Linear, 0.2)
  2522. TweenJoint(Grip, Grip.C0, CFANG(0, RAD(10), 0), Linear, 0.2)
  2523. wait(0.3)
  2524. end;
  2525.  
  2526. function()
  2527. Grip.Part0 = Torso
  2528. Grip.C1 = CF(-1, 0.5, -0.5)
  2529.  
  2530. if S.LethalGrenadeType == 3 and Type == 1 then
  2531. Grenade0 = CreateKnife()
  2532. Grenade0.Parent = Gun_Ignore
  2533.  
  2534. local Weld = Instance.new("Weld")
  2535. Weld.Part0 = FakeRArm
  2536. Weld.Part1 = Grenade0
  2537. Weld.C0 = Grip.C0
  2538. Weld.C1 = CF(0, 0, -0.5) * CFANG(RAD(90), RAD(90), 0)
  2539. Weld.Parent = Grenade0
  2540.  
  2541. TweenJoint(LWeld2, CF(), CF(), Sine, 0.3)
  2542. TweenJoint(RWeld2, CF(), CF(), Sine, 0.3)
  2543. TweenJoint(LWeld, ArmC0[1], CF(0, 0.5, 0.1) * CFANG(RAD(90), 0, 0), Sine, 0.3)
  2544. TweenJoint(RWeld, ArmC0[2], CF(0, 0.4, 0.1) * CFANG(RAD(-80), 0, 0), Sine, 0.3)
  2545. wait(0.3)
  2546. else
  2547. Grenade0 = CreateGrenade()
  2548. Grenade0.Parent = Gun_Ignore
  2549.  
  2550. local Weld = Instance.new("Weld")
  2551. Weld.Part0 = FakeRArm
  2552. Weld.Part1 = Grenade0:WaitForChild("Center")
  2553. Weld.C0 = Grip.C0
  2554. Weld.Parent = Grenade0:WaitForChild("Center")
  2555.  
  2556. TweenJoint(LWeld2, CF(), CFANG(0, RAD(80), 0), Linear, 0.25)
  2557. TweenJoint(RWeld2, CF(), CFANG(0, RAD(-80), 0), Linear, 0.25)
  2558. TweenJoint(LWeld, ArmC0[1], CF(-0.2, 0.8, 0.1) * CFANG(RAD(10), 0, RAD(-30)), Linear, 0.25)
  2559. TweenJoint(RWeld, ArmC0[2], CF(0.2, 0.8, 0.1) * CFANG(RAD(10), 0, RAD(30)), Linear, 0.25)
  2560. wait(0.3)
  2561. end
  2562. end;
  2563.  
  2564. function()
  2565. repeat wait() until (not Keys[S.LethalGrenadeKey]) and (not Keys[S.TacticalGrenadeKey]) or (not Selected)
  2566. end;
  2567.  
  2568. function()
  2569. if S.LethalGrenadeType ~= 3 or Type == 2 then
  2570. TweenJoint(LWeld2, CF(), CFANG(0, RAD(45), 0), Sine, 0.2)
  2571. TweenJoint(RWeld2, CF(), CFANG(0, RAD(-45), 0), Sine, 0.2)
  2572. TweenJoint(LWeld, ArmC0[1], CF(0, 0.8, 0.1), Sine, 0.2)
  2573. TweenJoint(RWeld, ArmC0[2], CF(0, 0.8, 0.1), Sine, 0.2)
  2574. wait(0.2)
  2575. end
  2576. end;
  2577.  
  2578. function()
  2579. if S.LethalGrenadeType ~= 3 or Type == 2 then
  2580. TweenJoint(LWeld2, CF(), CF(), Sine, 0.3)
  2581. TweenJoint(RWeld2, CF(), CF(), Sine, 0.3)
  2582. TweenJoint(LWeld, ArmC0[1], CF(0, 0.5, 0.1) * CFANG(RAD(90), 0, 0), Sine, 0.3)
  2583. TweenJoint(RWeld, ArmC0[2], CF(0, 0.4, 0.1) * CFANG(RAD(-80), 0, 0), Sine, 0.3)
  2584. wait(0.3)
  2585. end
  2586. end;
  2587.  
  2588. function()
  2589. TweenJoint(RWeld, ArmC0[2], CF(0, 0.8, 0.1) * CFANG(RAD(-10), 0, 0), Sine, 0.1)
  2590. wait(0.07)
  2591. end;
  2592.  
  2593. function()
  2594. local Main = nil
  2595. Grenade0:Destroy()
  2596.  
  2597. if S.LethalGrenadeType == 3 and Type == 1 then
  2598. local Grenade1 = CreateKnife()
  2599. Main = Grenade1
  2600.  
  2601. Grenade1.Parent = Gun_Ignore
  2602.  
  2603. Main.CFrame = FakeRArm.CFrame * Grip.C0 * CF(0, 0.5, 0) * CFANG(RAD(-90), 0, RAD(90))
  2604. Main.Velocity = Main.Velocity + ((Head.CFrame * CFANG(RAD(7), 0, 0)).lookVector * S.LethalGrenadeThrowVelocity)
  2605. Main.RotVelocity = (Main.CFrame * CFANG(RAD(90), 0, 0)).lookVector * 20
  2606. else
  2607. local Grenade1 = CreateGrenade()
  2608. Main = Grenade1:WaitForChild("Center")
  2609.  
  2610. local Sound = Instance.new("Sound")
  2611. Sound.SoundId = (Type == 1 and S.ExplosionSound or "rbxassetid://156283116")
  2612. Sound.Volume = 1
  2613. Sound.PlayOnRemove = true
  2614. Sound.Parent = Main
  2615.  
  2616. Grenade1.Parent = Gun_Ignore
  2617.  
  2618. Main.CanCollide = true
  2619. Main.CFrame = FakeRArm.CFrame * Grip.C0
  2620. if Type == 1 then
  2621. Main.Velocity = Main.Velocity + ((Head.CFrame * CFANG(RAD(7), 0, 0)).lookVector * S.LethalGrenadeThrowVelocity)
  2622. elseif Type == 2 then
  2623. Main.Velocity = Main.Velocity + ((Head.CFrame * CFANG(RAD(7), 0, 0)).lookVector * S.TacticalGrenadeThrowVelocity)
  2624. end
  2625. end
  2626.  
  2627. spawn(function()
  2628. if Type == 1 then
  2629. if S.LethalGrenadeType == 1 then
  2630. if S.TimerStartOnHit then
  2631. local Detonated = false
  2632. Main.Touched:connect(function(Obj)
  2633. if IsIgnored(Obj) or Detonated then return end
  2634. Main.Velocity = Main.Velocity / 4
  2635. Detonated = true
  2636.  
  2637. wait(S.DetonationTime)
  2638.  
  2639. DetonateExplosive(Main)
  2640. end)
  2641. else
  2642. spawn(function()
  2643. local Touched = false
  2644. Main.Touched:connect(function(Obj)
  2645. if IsIgnored(Obj) or Touched then return end
  2646. Touched = true
  2647. Main.Velocity = Main.Velocity / 4
  2648. end)
  2649. end)
  2650. wait(S.DetonationTime)
  2651. DetonateExplosive(Main)
  2652. end
  2653. elseif S.LethalGrenadeType == 2 then
  2654. local Detonated = false
  2655. local GrenadeCF = nil
  2656. Main.Touched:connect(function(Obj)
  2657. if IsIgnored(Obj) or Detonated then return end
  2658. GrenadeCF = Main.CFrame
  2659.  
  2660. local W = Instance.new("Weld")
  2661. W.Name = "Semtex"
  2662. W.Part0 = Main
  2663. W.Part1 = Obj
  2664. W.C0 = GrenadeCF:toObjectSpace(Obj.CFrame)
  2665. W.Parent = Main
  2666.  
  2667. Main.ChildRemoved:connect(function(C)
  2668. if C.Name == "Semtex" then
  2669. local W = Instance.new("Weld")
  2670. W.Name = "Semtex"
  2671. W.Part0 = Main
  2672. W.Part1 = Obj
  2673. W.C0 = GrenadeCF:toObjectSpace(Obj.CFrame)
  2674. W.Parent = Main
  2675. end
  2676. end)
  2677.  
  2678. if S.TimerStartOnHit then
  2679. Detonated = true
  2680. wait(S.DetonationTime)
  2681. DetonateExplosive(Main)
  2682. end
  2683. end)
  2684.  
  2685. if (not S.TimerStartOnHit) then
  2686. wait(S.DetonationTime)
  2687. Detonated = true
  2688. DetonateExplosive(Main)
  2689. end
  2690. elseif S.LethalGrenadeType == 3 then
  2691. local Touched = false
  2692. Main.Touched:connect(function(Obj)
  2693. if IsIgnored(Obj) or Touched then return end
  2694. Touched = true
  2695.  
  2696. local W = Instance.new("Weld")
  2697. W.Name = "Sticky"
  2698. W.Part0 = Main
  2699. W.Part1 = Obj
  2700. W.C0 = Main.CFrame:toObjectSpace(Obj.CFrame)
  2701. W.Parent = Main
  2702.  
  2703. Main.ChildRemoved:connect(function(C)
  2704. if C.Name == "Sticky" then
  2705. local W = Instance.new("Weld")
  2706. W.Name = "Sticky"
  2707. W.Part0 = Main
  2708. W.Part1 = Obj
  2709. W.C0 = Main.CFrame:toObjectSpace(Obj.CFrame)
  2710. W.Parent = Main
  2711. end
  2712. end)
  2713.  
  2714. if Obj then
  2715. if Obj.Parent.ClassName == "Hat" then
  2716. local HitHumanoid = FindFirstClass(Obj.Parent.Parent, "Humanoid")
  2717. if HitHumanoid and IsEnemy(HitHumanoid) then
  2718. local CreatorTag = Instance.new("ObjectValue")
  2719. CreatorTag.Name = "creator"
  2720. CreatorTag.Value = Player
  2721. CreatorTag.Parent = HitHumanoid
  2722. HitHumanoid:TakeDamage(HitHumanoid.MaxHealth)
  2723. MarkHit()
  2724. end
  2725. else
  2726. local HitHumanoid = FindFirstClass(Obj.Parent, "Humanoid")
  2727. if HitHumanoid and IsEnemy(HitHumanoid) then
  2728. local CreatorTag = Instance.new("ObjectValue")
  2729. CreatorTag.Name = "creator"
  2730. CreatorTag.Value = Player
  2731. CreatorTag.Parent = HitHumanoid
  2732. HitHumanoid:TakeDamage(HitHumanoid.MaxHealth)
  2733. MarkHit()
  2734. end
  2735. end
  2736. end
  2737.  
  2738. wait(3)
  2739.  
  2740. Main:Destroy()
  2741. end)
  2742. end
  2743. elseif Type == 2 then
  2744. if S.TacticalGrenadeType == 1 then
  2745. if S.TimerStartOnHit then
  2746. local Detonated = false
  2747. Main.Touched:connect(function(Obj)
  2748. if IsIgnored(Obj) or Detonated then return end
  2749. Main.Velocity = Main.Velocity / 2
  2750. Detonated = true
  2751.  
  2752. wait(S.DetonationTime)
  2753.  
  2754. DetonateSmoke(Main)
  2755. end)
  2756. else
  2757. spawn(function()
  2758. local Touched = false
  2759. Main.Touched:connect(function(Obj)
  2760. if IsIgnored(Obj) or Touched then return end
  2761. Touched = true
  2762. Main.Velocity = Main.Velocity / 2
  2763. end)
  2764. end)
  2765. wait(S.DetonationTime)
  2766. DetonateSmoke(Main)
  2767. end
  2768. end
  2769. end
  2770. end)
  2771.  
  2772. if S.GrenadeTrail and S.GrenadeTrailTransparency ~= 1 then
  2773. spawn(function()
  2774. local LastPos = nil
  2775. while true do
  2776. if LastPos then
  2777. if (not Main:IsDescendantOf(game))
  2778. or (Main.Name == "Knife" and FindFirstClass(Main, "Weld")) then
  2779. break
  2780. end
  2781. local Trail = Instance.new("Part")
  2782. Trail.BrickColor = S.GrenadeTrailColor
  2783. Trail.Transparency = S.GrenadeTrailTransparency
  2784. Trail.Anchored = true
  2785. Trail.CanCollide = false
  2786. Trail.Size = VEC3(1, 1, 1)
  2787. local Mesh = Instance.new("BlockMesh")
  2788. Mesh.Offset = VEC3(0, 0, -(Main.Position - LastPos).magnitude / 2)
  2789. Mesh.Scale = VEC3(S.GrenadeTrailThickness, S.GrenadeTrailThickness, (Main.Position - LastPos).magnitude)
  2790. Mesh.Parent = Trail
  2791. Trail.Parent = Gun_Ignore
  2792. Trail.CFrame = CF(LastPos, Main.Position)
  2793. delay(S.GrenadeTrailVisibleTime, function()
  2794. if S.GrenadeTrailDisappearTime > 0 then
  2795. local X = 0
  2796. while true do
  2797. if X == 90 then break end
  2798. if (not Selected) then break end
  2799. local NewX = X + (1.5 / S.GrenadeTrailDisappearTime)
  2800. X = (NewX > 90 and 90 or NewX)
  2801. local Alpha = X / 90
  2802. Trail.Transparency = NumLerp(S.GrenadeTrailTransparency, 1, Alpha)
  2803. RS:wait()
  2804. end
  2805. Trail:Destroy()
  2806. else
  2807. Trail:Destroy()
  2808. end
  2809. end)
  2810. LastPos = Main.Position
  2811. else
  2812. LastPos = Main.Position
  2813. end
  2814. RS:wait()
  2815. end
  2816. end)
  2817. end
  2818. wait(0.2)
  2819. end;
  2820.  
  2821. function()
  2822. TweenJoint(RWeld, CF(1.5, 0, 0) * CFANG(0, 0, RAD(-10)), CF(0, 0.6, 0), Linear, 0.2)
  2823. wait(0.3)
  2824. end;
  2825.  
  2826. function()
  2827. Grip.Part0 = RArm
  2828. Grip.C1 = CFANG(0, RAD(20), 0)
  2829.  
  2830. TweenJoint(LWeld, ArmC0[1], S.ArmC1_UnAimed.Left, Linear, 0.2)
  2831. TweenJoint(RWeld, ArmC0[2], S.ArmC1_UnAimed.Right, Linear, 0.2)
  2832. wait(0.2)
  2833. end;
  2834. }
  2835.  
  2836. for _,F in pairs(AnimTable) do
  2837. if (not Selected) then
  2838. break
  2839. end
  2840. F()
  2841. end
  2842.  
  2843. if (not Selected) and Grenade0 then
  2844. Grenade0:Destroy()
  2845. end
  2846. end
  2847.  
  2848. --------------------[ CAMERA STEADYING FUNCTIONS ]------------------------------------
  2849.  
  2850. function SteadyCamera()
  2851. Gui_Clone.Scope.Steady.Text = "Steadying..."
  2852. Gui_Clone.Scope.Steady.TextColor3 = Color3.new(1, 1, 0)
  2853. CameraSteady = true
  2854. local OriginalSway = CameraSway
  2855. for X = 0, 90, 1.5 / 0.6 do
  2856. if (not Run_Key_Pressed) then break end
  2857. local Alpha = SIN(RAD(X))
  2858. CameraSway = NumLerp(OriginalSway, 0, Alpha)
  2859. RS:wait()
  2860. end
  2861. while Run_Key_Pressed and Aimed do
  2862. if CurrentSteadyTime > 0 then
  2863. local NewSteadyTime = CurrentSteadyTime - 1
  2864. CurrentSteadyTime = (NewSteadyTime < 0 and 0 or NewSteadyTime)
  2865. CameraSway = 0
  2866. elseif CurrentSteadyTime == 0 then
  2867. break
  2868. end
  2869. RS:wait()
  2870. end
  2871. CameraSteady = false
  2872. spawn(function()
  2873. for X = 0, 90, 1.5 / 0.2 do
  2874. local Alpha = math.log10(X) / math.log10(90)
  2875. CameraSway = NumLerp(0, 3, Alpha)
  2876. RS:wait()
  2877. end
  2878. for X = 0, 90, 1.5 / S.ScopeSteadyTime do
  2879. if CameraSteady then break end
  2880. local Alpha = SIN(RAD(X))
  2881. CameraSway = NumLerp(3, 1, Alpha)
  2882. RS:wait()
  2883. end
  2884. end)
  2885. RetakeBreath()
  2886. end
  2887.  
  2888. function RetakeBreath()
  2889. local Steady = Gui_Clone.Scope.Steady
  2890. Steady.Text = "Re-taking Breath"
  2891. Steady.TextColor3 = Color3.new(1, 0, 0)
  2892. TakingBreath = true
  2893. while TakingBreath do
  2894. if CurrentSteadyTime < MaxSteadyTime then
  2895. local NewSteadyTime = CurrentSteadyTime + (S.ScopeSteadyTime / S.SteadyCooldownTime)
  2896. CurrentSteadyTime = (NewSteadyTime > MaxSteadyTime and MaxSteadyTime or NewSteadyTime)
  2897. elseif CurrentSteadyTime >= MaxSteadyTime then
  2898. break
  2899. end
  2900. RS:wait()
  2901. end
  2902. if TakingBreath then
  2903. Steady.Text = "Hold "..ConvertKey(S.ScopeSteadyKey).." to Steady"
  2904. Steady.TextColor3 = Color3.new(1, 1, 0)
  2905. TakingBreath = false
  2906. end
  2907. end
  2908.  
  2909. --------------------[ SPRINTING FUNCTIONS ]-------------------------------------------
  2910.  
  2911. function MonitorStamina()
  2912. while Run_Key_Pressed do
  2913. if (not Aimed) and (not Aiming) then
  2914. break
  2915. end
  2916. RS:wait()
  2917. end
  2918. while Run_Key_Pressed and (not Aiming) and (not Aimed) and (not Knifing) and (not ThrowingGrenade) do
  2919. local Forward = (Keys["w"] or Keys[string.char(17)])
  2920. local Backward = (Keys["s"] or Keys[string.char(18)])
  2921. if (Forward and (not Backward))
  2922. and Walking and (Stamina > 0) then
  2923. if Stance == 1 or Stance == 2 then Stand() end
  2924. local NewStamina = Stamina - 1
  2925. Stamina = (NewStamina < 0 and 0 or NewStamina)
  2926. Running = true
  2927. elseif (not (Forward and (not Backward)))
  2928. or (not Walking) or (Stamina == 0) then
  2929. break
  2930. end
  2931. RS:wait()
  2932. end
  2933. Running = false
  2934. RechargeStamina()
  2935. end
  2936.  
  2937. function RechargeStamina()
  2938. ChargingStamina = true
  2939. while ((not Run_Key_Pressed) or (Stamina < MaxStamina)) and (not Running) do
  2940. if Stamina < MaxStamina then
  2941. local NewStamina = Stamina + (S.SprintTime / S.StaminaCoolTime)
  2942. Stamina = (NewStamina > MaxStamina and MaxStamina or NewStamina)
  2943. elseif Stamina >= MaxStamina then
  2944. break
  2945. end
  2946. RS:wait()
  2947. end
  2948. ChargingStamina = false
  2949. end
  2950.  
  2951. --------------------[ STANCE FUNCTIONS ]----------------------------------------------
  2952.  
  2953. function Stand(OnDeselected)
  2954. local LHip = Torso["Left Hip"]
  2955. local RHip = Torso["Right Hip"]
  2956. local Root = HRP.RootJoint
  2957. Stance = 0
  2958. if S.StanceAnimation and (not OnDeselected) then
  2959. spawn(function()
  2960. local PreviousOffset = Humanoid.CameraOffset
  2961. local PreviousRootP = Root.C0.p
  2962. for X = 0, 90, 1.5 / S.StanceChangeSpeed do
  2963. if Stance ~= 0 then break end
  2964. local Alpha = Sine(X)
  2965. Humanoid.CameraOffset = PreviousOffset:lerp(StanceOffset[1], Alpha)
  2966. Root.C0 = CF(PreviousRootP:lerp(VEC3(), Alpha)) * CFANG(RAD(-90), 0, RAD(180))
  2967. RS:wait()
  2968. end
  2969. end)
  2970. TweenJoint(ABWeld, CF(), CF(), Sine, S.StanceChangeSpeed)
  2971. TweenJoint(LHip, CF(-1, -1, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0), Sine, S.StanceChangeSpeed)
  2972. 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.StanceChangeSpeed)
  2973. elseif OnDeselected then
  2974. Humanoid.CameraOffset = StanceOffset[1]
  2975. ABWeld.C0 = CF()
  2976. ABWeld.C1 = CF()
  2977. LHip.C0 = CF(-1, -1, 0) * CFANG(0, RAD(-90), 0)
  2978. LHip.C1 = CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0)
  2979. RHip.C0 = CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0)
  2980. RHip.C1 = CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0)
  2981. Root.C0 = CFANG(RAD(-90), 0, RAD(180))
  2982. end
  2983. end
  2984.  
  2985. function Crouch()
  2986. local LHip = Torso["Left Hip"]
  2987. local RHip = Torso["Right Hip"]
  2988. local Root = HRP.RootJoint
  2989. Stance = 1
  2990. if S.StanceAnimation then
  2991. spawn(function()
  2992. local PreviousOffset = Humanoid.CameraOffset
  2993. local PreviousRootP = Root.C0.p
  2994. for X = 0, 90, 1.5 / S.StanceChangeSpeed do
  2995. if Stance ~= 1 then break end
  2996. local Alpha = Sine(X)
  2997. Humanoid.CameraOffset = PreviousOffset:lerp(StanceOffset[2], Alpha)
  2998. Root.C0 = CF(PreviousRootP:lerp(VEC3(0, -1, 0), Alpha)) * CFANG(RAD(-90), 0, RAD(180))
  2999. RS:wait()
  3000. end
  3001. end)
  3002. TweenJoint(ABWeld, CF(0, 0, -1 / 16), CF(), Sine, S.StanceChangeSpeed)
  3003. 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.StanceChangeSpeed)
  3004. 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.StanceChangeSpeed)
  3005. else
  3006. Humanoid.CameraOffset = StanceOffset[2]
  3007. ABWeld.C0 = CF(0, 0, -1 / 16)
  3008. ABWeld.C1 = CF()
  3009. LHip.C0 = CF(-1, -0.5, 0) * CFANG(0, RAD(-90), 0)
  3010. LHip.C1 = CF(-0.5, 0.5, 1) * CFANG(0, RAD(-90), RAD(-90))
  3011. RHip.C0 = CF(1, -0.5, 0.25) * CFANG(RAD(-180), RAD(90), 0)
  3012. RHip.C1 = CF(0.5, 0.5, 1) * CFANG(RAD(-180), RAD(90), 0)
  3013. Root.C0 = CF(0, -1, 0) * CFANG(RAD(-90), 0, RAD(180))
  3014. end
  3015. end
  3016.  
  3017. function Prone()
  3018. local LHip = Torso["Left Hip"]
  3019. local RHip = Torso["Right Hip"]
  3020. local Root = HRP.RootJoint
  3021. Stance = 2
  3022. if S.StanceAnimation then
  3023. spawn(function()
  3024. local PreviousOffset = Humanoid.CameraOffset
  3025. local PreviousRootP = Root.C0.p
  3026. for X = 0, 90, 1.5 / S.StanceChangeSpeed do
  3027. if Stance ~= 2 then break end
  3028. local Alpha = Sine(X)
  3029. Humanoid.CameraOffset = PreviousOffset:lerp(StanceOffset[3], Alpha)
  3030. Root.C0 = CF(PreviousRootP:lerp(VEC3(0, -2.5, 1), Alpha)) * CFANG(RAD(180), 0, RAD(180))
  3031. RS:wait()
  3032. end
  3033. end)
  3034. TweenJoint(ABWeld, CF(0, 0, -1 / 8), CF(), Sine, S.StanceChangeSpeed)
  3035. TweenJoint(LHip, CF(-1, -1, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0), Sine, S.StanceChangeSpeed)
  3036. 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.StanceChangeSpeed)
  3037. else
  3038. Humanoid.CameraOffset = StanceOffset[3]
  3039. ABWeld.C0 = CF(0, 0, -1 / 8)
  3040. ABWeld.C1 = CF()
  3041. LHip.C0 = CF(-1, -1, 0) * CFANG(0, RAD(-90), 0)
  3042. LHip.C1 = CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0)
  3043. RHip.C0 = CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0)
  3044. RHip.C1 = CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0)
  3045. Root.C0 = CF(0, -2.5, 1) * CFANG(RAD(180), 0, RAD(180))
  3046. end
  3047. end
  3048.  
  3049. function Dive(Speed)
  3050. local DiveVelocity = (HRP.CFrame * CFANG(RAD(18),0,0)).lookVector * Speed * (35 / 16) * 4e3
  3051. HRP.Velocity = VEC3()
  3052. Torso.Velocity = VEC3()
  3053. local BF = Instance.new("BodyForce")
  3054. BF.force = DiveVelocity
  3055. BF.Parent = HRP
  3056. delay(0.05, function()
  3057. Prone()
  3058. local Start = tick()
  3059. while true do
  3060. wait()
  3061. if (tick() - Start) > 0.1 then break end
  3062. BF.force = -HRP.Velocity * 700
  3063. end
  3064. BF:Destroy()
  3065. end)
  3066. end
  3067.  
  3068. --------------------[ KEYBOARD FUNCTIONS ]--------------------------------------------
  3069.  
  3070. function KeyDown(K)
  3071. local Key = string.lower(K)
  3072.  
  3073. if Key == S.LowerStanceKey and S.CanChangeStance then
  3074. if (not Running) then
  3075. if Stance == 0 then
  3076. Crouch()
  3077. elseif Stance == 1 then
  3078. Prone()
  3079. end
  3080. elseif S.DolphinDive then
  3081. delay(1 / 30,function()
  3082. CanRun = false
  3083. Dive(S.BaseWalkSpeed)
  3084. Run_Key_Pressed = false
  3085. wait(S.DiveRechargeTime)
  3086. CanRun = true
  3087. end)
  3088. end
  3089. end
  3090.  
  3091. if Key == S.RaiseStanceKey and S.CanChangeStance then
  3092. if (not Running) then
  3093. if Stance == 2 then
  3094. Crouch()
  3095. elseif Stance == 1 then
  3096. Stand()
  3097. end
  3098. end
  3099. end
  3100.  
  3101. if Key == S.ADSKey then
  3102. if S.HoldMouseOrKeyToADS then
  3103. if (not AimingIn) and (not Aimed) then
  3104. AimingIn = true
  3105. AimGun()
  3106. AimingIn = false
  3107. end
  3108. else
  3109. if Aimed then
  3110. UnAimGun()
  3111. else
  3112. AimGun()
  3113. end
  3114. end
  3115. end
  3116.  
  3117. if Key == S.ReloadKey then
  3118. if (not Reloading) and (not Running) then
  3119. Reload()
  3120. end
  3121. end
  3122.  
  3123.  
  3124. if Key == S.KnifeKey and S.CanKnife then
  3125. if KnifeReady and (not Knifing) and (not ThrowingGrenade) then
  3126. if Aimed then UnAimGun(true) end
  3127. BreakReload = true
  3128. Knifing = true
  3129. KnifeReady = false
  3130. KnifeAnim()
  3131. BreakReload = false
  3132. Knifing = false
  3133. delay(S.KnifeCooldown, function()
  3134. KnifeReady = true
  3135. end)
  3136. end
  3137. end
  3138.  
  3139. if Key == S.LethalGrenadeKey and S.Throwables then
  3140. if (not Knifing) and (not Running) and (not Aimed) and (not Aiming) and (not ThrowingGrenade) then
  3141. if LethalGrenades.Value > 0 then
  3142. LethalGrenades.Value = LethalGrenades.Value - 1
  3143. ThrowingGrenade = true
  3144. ThrowGrenade(1)
  3145. ThrowingGrenade = false
  3146. end
  3147. end
  3148. end
  3149.  
  3150. if Key == S.TacticalGrenadeKey and S.Throwables then
  3151. if (not Knifing) and (not Running) and (not Aimed) and (not Aiming) and (not ThrowingGrenade) then
  3152. if TacticalGrenades.Value > 0 then
  3153. TacticalGrenades.Value = TacticalGrenades.Value - 1
  3154. ThrowingGrenade = true
  3155. ThrowGrenade(2)
  3156. ThrowingGrenade = false
  3157. end
  3158. end
  3159. end
  3160.  
  3161. if Key == S.SprintKey then
  3162. Run_Key_Pressed = true
  3163. if Aimed and (not Aiming) then
  3164. TakingBreath = false
  3165. SteadyCamera()
  3166. end
  3167. if CanRun then
  3168. if (not Idleing) and Walking and (not Running) and (not Knifing) and (not ThrowingGrenade) then
  3169. if Reloading then BreakReload = true end
  3170. MonitorStamina()
  3171. end
  3172. end
  3173. end
  3174. end
  3175.  
  3176. function KeyUp(K)
  3177. local Key = string.lower(K)
  3178.  
  3179. if Key == S.ADSKey then
  3180. if S.HoldMouseOrKeyToADS then
  3181. if (not AimingOut) and Aimed then
  3182. AimingOut = true
  3183. UnAimGun()
  3184. AimingOut = false
  3185. end
  3186. end
  3187. end
  3188.  
  3189. if Key == S.SprintKey then
  3190. Run_Key_Pressed = false
  3191. Running = false
  3192. if (not ChargingStamina) then
  3193. RechargeStamina()
  3194. end
  3195. end
  3196. end
  3197.  
  3198. --------------------[ END FUNCTIONS ]-------------------------------------------------
  3199.  
  3200. --------------------------------------------------------------------------------------
  3201. --------------------[ TOOL SELECTION AND DESELECTION ]--------------------------------
  3202. --------------------------------------------------------------------------------------
  3203.  
  3204. function OnEquipped(M_Icon)
  3205. wait(math.random(10, 40) / 100)
  3206. if Humanoid.Health ~= 0 and (not Selected) and Gun.Parent == Character then
  3207. Selected = true
  3208.  
  3209. BreakReload = false
  3210.  
  3211. --------------------[ FAILSAFE RESETING ]-------------------------------------
  3212.  
  3213. for _, GM in pairs(Ignore_Model:GetChildren()) do
  3214. if GM.Name == "Gun_Ignore_"..Player.Name then
  3215. GM:Destroy()
  3216. end
  3217. end
  3218.  
  3219. for _,c in pairs(Connections) do
  3220. c:disconnect()
  3221. end
  3222.  
  3223. Connections = {}
  3224.  
  3225. --------------------[ CREATING IGNORE MODELS ]--------------------------------
  3226.  
  3227. Gun_Ignore = Instance.new("Model")
  3228. Gun_Ignore.Name = "Gun_Ignore_"..Player.Name
  3229. Gun_Ignore.Parent = Ignore_Model
  3230.  
  3231. --------------------[ MODIFYING THE PLAYER ]----------------------------------
  3232.  
  3233. M_Icon.Icon = "rbxasset://textures\\Blank.png"
  3234.  
  3235. Gui_Clone = Main_Gui:Clone()
  3236. Gui_Clone.Parent = Player.PlayerGui
  3237.  
  3238. SetUpGui()
  3239.  
  3240. Shoulders.Right.Part1 = nil
  3241. Shoulders.Left.Part1 = nil
  3242.  
  3243. PrevNeckCF.C0 = Neck.C0
  3244. PrevNeckCF.C1 = Neck.C1
  3245.  
  3246. BG = Instance.new("BodyGyro", HRP)
  3247. BG.maxTorque = VEC3(HUGE, HUGE, HUGE)
  3248. BG.Name = "BG"
  3249. BG.P = 1e5
  3250. BG.cframe = CF(Torso.CFrame.p, Torso.CFrame.p + Torso.CFrame.lookVector)
  3251.  
  3252. local PlayerFolder = Instance.new("Model")
  3253. PlayerFolder.Name = "PlayerFolder"
  3254. PlayerFolder.Parent = Gun_Ignore
  3255.  
  3256. local AnimBase = Instance.new("Part")
  3257. AnimBase.Transparency = 1
  3258. AnimBase.Name = "AnimBase"
  3259. AnimBase.CanCollide = false
  3260. AnimBase.FormFactor = Enum.FormFactor.Custom
  3261. AnimBase.Size = VEC3(0.2, 0.2, 0.2)
  3262. AnimBase.BottomSurface = Enum.SurfaceType.Smooth
  3263. AnimBase.TopSurface = Enum.SurfaceType.Smooth
  3264. AnimBase.Parent = PlayerFolder
  3265.  
  3266. AnimWeld = Instance.new("Weld")
  3267. AnimWeld.Part0 = AnimBase
  3268. AnimWeld.Part1 = Head
  3269. AnimWeld.C0 = CF(0, 1, 0)
  3270. AnimWeld.Parent = AnimBase
  3271.  
  3272. local ArmBase = Instance.new("Part")
  3273. ArmBase.Transparency = 1
  3274. ArmBase.Name = "ArmBase"
  3275. ArmBase.CanCollide = false
  3276. ArmBase.FormFactor = Enum.FormFactor.Custom
  3277. ArmBase.Size = VEC3(0.2, 0.2, 0.2)
  3278. ArmBase.BottomSurface = Enum.SurfaceType.Smooth
  3279. ArmBase.TopSurface = Enum.SurfaceType.Smooth
  3280. ArmBase.Parent = PlayerFolder
  3281.  
  3282. ABWeld = Instance.new("Weld")
  3283. ABWeld.Part0 = ArmBase
  3284. ABWeld.Part1 = AnimBase
  3285. ABWeld.Parent = ArmBase
  3286.  
  3287. local LArmBase = Instance.new("Part")
  3288. LArmBase.Transparency = 1
  3289. LArmBase.Name = "LArmBase"
  3290. LArmBase.CanCollide = false
  3291. LArmBase.FormFactor = Enum.FormFactor.Custom
  3292. LArmBase.Size = VEC3(0.2, 0.2, 0.2)
  3293. LArmBase.BottomSurface = Enum.SurfaceType.Smooth
  3294. LArmBase.TopSurface = Enum.SurfaceType.Smooth
  3295. LArmBase.Parent = PlayerFolder
  3296.  
  3297. local RArmBase = Instance.new("Part")
  3298. RArmBase.Transparency = 1
  3299. RArmBase.Name = "RArmBase"
  3300. RArmBase.CanCollide = false
  3301. RArmBase.FormFactor = Enum.FormFactor.Custom
  3302. RArmBase.Size = VEC3(0.2, 0.2, 0.2)
  3303. RArmBase.BottomSurface = Enum.SurfaceType.Smooth
  3304. RArmBase.TopSurface = Enum.SurfaceType.Smooth
  3305. RArmBase.Parent = PlayerFolder
  3306.  
  3307. LWeld = Instance.new("Weld")
  3308. LWeld.Name = "LWeld"
  3309. LWeld.Part0 = ArmBase
  3310. LWeld.Part1 = LArmBase
  3311. LWeld.C0 = ArmC0[1]
  3312. LWeld.C1 = S.ArmC1_UnAimed.Left
  3313. LWeld.Parent = ArmBase
  3314.  
  3315. RWeld = Instance.new("Weld")
  3316. RWeld.Name = "RWeld"
  3317. RWeld.Part0 = ArmBase
  3318. RWeld.Part1 = RArmBase
  3319. RWeld.C0 = ArmC0[2]
  3320. RWeld.C1 = S.ArmC1_UnAimed.Right
  3321. RWeld.Parent = ArmBase
  3322.  
  3323. LWeld2 = Instance.new("Weld")
  3324. LWeld2.Name = "LWeld"
  3325. LWeld2.Part0 = LArmBase
  3326. LWeld2.Part1 = LArm
  3327. LWeld2.Parent = LArmBase
  3328.  
  3329. RWeld2 = Instance.new("Weld")
  3330. RWeld2.Name = "RWeld"
  3331. RWeld2.Part0 = RArmBase
  3332. RWeld2.Part1 = RArm
  3333. RWeld2.Parent = RArmBase
  3334.  
  3335. if S.PlayerArms then
  3336. FakeLArm = LArm:Clone()
  3337. FakeLArm.Parent = PlayerFolder
  3338. FakeLArm.Transparency = S.FakeArmTransparency
  3339. FakeLArm:BreakJoints()
  3340.  
  3341. LArm.Transparency = 1
  3342.  
  3343. local FakeLWeld = Instance.new("Weld")
  3344. FakeLWeld.Part0 = FakeLArm
  3345. FakeLWeld.Part1 = LArm
  3346. FakeLWeld.Parent = FakeLArm
  3347.  
  3348. FakeRArm = RArm:Clone()
  3349. FakeRArm.Parent = PlayerFolder
  3350. FakeRArm.Transparency = S.FakeArmTransparency
  3351. FakeRArm:BreakJoints()
  3352.  
  3353. RArm.Transparency = 1
  3354.  
  3355. local FakeRWeld = Instance.new("Weld")
  3356. FakeRWeld.Part0 = FakeRArm
  3357. FakeRWeld.Part1 = RArm
  3358. FakeRWeld.Parent = FakeRArm
  3359.  
  3360. Instance.new("Humanoid", PlayerFolder)
  3361.  
  3362. for _,Obj in pairs(Character:GetChildren()) do
  3363. if Obj:IsA("CharacterMesh") or Obj:IsA("Shirt") then
  3364. Obj:Clone().Parent = PlayerFolder
  3365. end
  3366. end
  3367. else
  3368. local ArmTable = CreateArms()
  3369. ArmTable[1].Model.Parent = PlayerFolder
  3370. ArmTable[2].Model.Parent = PlayerFolder
  3371.  
  3372. FakeLArm = ArmTable[1].ArmPart
  3373.  
  3374. LArm.Transparency = 1
  3375.  
  3376. local FakeLWeld = Instance.new("Weld")
  3377. FakeLWeld.Part0 = FakeLArm
  3378. FakeLWeld.Part1 = LArm
  3379. FakeLWeld.Parent = FakeLArm
  3380.  
  3381. FakeRArm = ArmTable[2].ArmPart
  3382.  
  3383. RArm.Transparency = 1
  3384.  
  3385. local FakeRWeld = Instance.new("Weld")
  3386. FakeRWeld.Part0 = FakeRArm
  3387. FakeRWeld.Part1 = RArm
  3388. FakeRWeld.Parent = FakeRArm
  3389. end
  3390.  
  3391. --------------------[ MODIFYING THE GUN ]-------------------------------------
  3392.  
  3393. for _, Tab in pairs(Parts) do
  3394. local Weld = Instance.new("Weld")
  3395. Weld.Name = "MainWeld"
  3396. Weld.Part0 = Handle
  3397. Weld.Part1 = Tab.Obj
  3398. Weld.C0 = Tab.Obj.WeldCF.Value
  3399. Weld.Parent = Handle
  3400. Tab.Weld = Weld
  3401. end
  3402.  
  3403. Grip = RArm:WaitForChild("RightGrip")
  3404.  
  3405. local HandleCF = ArmBase.CFrame * ArmC0[2] * S.ArmC1_Aimed.Right:inverse() * CF(0, -1, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0)
  3406. local HandleOffset = AimPart.CFrame:toObjectSpace(Handle.CFrame)
  3407. Aimed_GripCF = (Head.CFrame * HandleOffset):toObjectSpace(HandleCF)
  3408.  
  3409. --------------------[ CONNECTIONS ]-------------------------------------------
  3410.  
  3411. INSERT(Connections, Humanoid.Died:connect(function()
  3412. OnUnequipped(true)
  3413. end))
  3414.  
  3415. INSERT(Connections, M2.Button1Down:connect(function()
  3416. MB1_Down = true
  3417. if S.GunType.Auto and (not S.GunType.Semi) and (not S.GunType.Burst) then
  3418. if (not CanFire) then return end
  3419. CanFire = false
  3420. if (not Running) and (not Knifing) and (not ThrowingGrenade) then
  3421. CurrentSpread = (
  3422. Aimed and S.Spread.Aimed or
  3423. ((Idleing and (not Walking)) and S.Spread.Hipfire or S.Spread.Walking)
  3424. )
  3425. while MB1_Down and (not Reloading) do
  3426. if Knifing and (not ThrowingGrenade) then break end
  3427. if Running then break end
  3428. if Ammo.Value > 0 then
  3429. Ammo.Value = Ammo.Value - 1
  3430. if Humanoid.Health ~= 0 then
  3431. if Aimed and Run_Key_Pressed and S.UnSteadyOnFire then
  3432. Run_Key_Pressed = false
  3433. CurrentSteadyTime = 0
  3434. end
  3435. Fire_Gun()
  3436. end
  3437. end
  3438. if Ammo.Value == 0 and S.AutoReload then
  3439. wait(0.2)
  3440. Reload()
  3441. end
  3442. wait(60 / S.FireRate)
  3443. end
  3444. end
  3445. CanFire = true
  3446. elseif (not S.GunType.Auto) and S.GunType.Burst then
  3447. if (not CanFire) then return end
  3448. CanFire = false
  3449. if (not Running) and (not Knifing) and (not ThrowingGrenade) then
  3450. CurrentSpread = (
  3451. Aimed and S.Spread.Aimed or
  3452. ((Idleing and (not Walking)) and S.Spread.Hipfire or S.Spread.Walking)
  3453. )
  3454. for i = 1, S.BurstAmount do
  3455. if Ammo.Value > 0 then
  3456. Ammo.Value = Ammo.Value - 1
  3457. if Humanoid.Health ~= 0 then
  3458. if Aimed and Run_Key_Pressed and S.UnSteadyOnFire then
  3459. Run_Key_Pressed = false
  3460. CurrentSteadyTime = 0
  3461. end
  3462. Fire_Gun()
  3463. end
  3464. end
  3465. if Ammo.Value == 0 and S.AutoReload then
  3466. wait(0.2)
  3467. Reload()
  3468. break
  3469. end
  3470. wait(S.BurstTime / S.BurstAmount)
  3471. end
  3472. end
  3473. wait(S.BurstWait)
  3474. CanFire = true
  3475. elseif (not S.GunType.Auto) and S.GunType.Semi then
  3476. if (not CanFire) then return end
  3477. CanFire = false
  3478. if (not Running) and (not Knifing) and (not ThrowingGrenade) then
  3479. CurrentSpread = (
  3480. Aimed and S.Spread.Aimed or
  3481. ((Idleing and (not Walking)) and S.Spread.Hipfire or S.Spread.Walking)
  3482. )
  3483. if Ammo.Value > 0 then
  3484. Ammo.Value = Ammo.Value - 1
  3485. if Humanoid.Health ~= 0 then
  3486. if Aimed and Run_Key_Pressed and S.UnSteadyOnFire then
  3487. Run_Key_Pressed = false
  3488. CurrentSteadyTime = 0
  3489. end
  3490. Fire_Gun()
  3491. end
  3492. end
  3493. if Ammo.Value == 0 and S.AutoReload then
  3494. wait(0.2)
  3495. Reload()
  3496. end
  3497. wait(60 / S.FireRate)
  3498. end
  3499. CanFire = true
  3500. elseif (not S.GunType.Auto) and (not S.GunType.Semi) and (not S.GunType.Burst) and S.GunType.Shot then
  3501. if (not CanFire) then return end
  3502. CanFire = false
  3503. if (not Running) and (not Knifing) and (not ThrowingGrenade) then
  3504. CurrentSpread = (
  3505. Aimed and S.Spread.Aimed or
  3506. ((Idleing and (not Walking)) and S.Spread.Hipfire or S.Spread.Walking)
  3507. )
  3508. if Ammo.Value > 0 then
  3509. Ammo.Value = Ammo.Value - 1
  3510. if Humanoid.Health ~= 0 then
  3511. if Aimed and Run_Key_Pressed and S.UnSteadyOnFire then
  3512. Run_Key_Pressed = false
  3513. CurrentSteadyTime = 0
  3514. end
  3515. Fire_Gun()
  3516. end
  3517. end
  3518. if Ammo.Value == 0 and S.AutoReload then
  3519. wait(0.2)
  3520. Reload()
  3521. end
  3522. wait(60 / S.FireRate)
  3523. end
  3524. CanFire = true
  3525. elseif (not S.GunType.Auto) and (not S.GunType.Semi) and S.GunType.Burst and (not S.GunType.Shot) then
  3526. if (not CanFire) then return end
  3527. CanFire = false
  3528. if (not Running) and (not Knifing) and (not ThrowingGrenade) then
  3529. CurrentSpread = (
  3530. Aimed and S.Spread.Aimed or
  3531. ((Idleing and (not Walking)) and S.Spread.Hipfire or S.Spread.Walking)
  3532. )
  3533. for i = 1, S.BurstAmount do
  3534. if Ammo.Value > 0 then
  3535. Ammo.Value = Ammo.Value - 1
  3536. if Humanoid.Health ~= 0 then
  3537. if Aimed and Run_Key_Pressed and S.UnSteadyOnFire then
  3538. Run_Key_Pressed = false
  3539. CurrentSteadyTime = 0
  3540. end
  3541. Fire_Gun()
  3542. end
  3543. end
  3544. if Ammo.Value == 0 and S.AutoReload then
  3545. wait(0.2)
  3546. Reload()
  3547. break
  3548. end
  3549. wait(S.BurstTime / S.BurstAmount)
  3550. end
  3551. end
  3552. wait(S.BurstWait)
  3553. CanFire = true
  3554. elseif (not S.GunType.Auto) and (not S.GunType.Burst) and (not S.GunType.Shot) and S.GunType.Explosive then
  3555. if (not CanFire) then return end
  3556. CanFire = false
  3557. if (not Running) and (not Knifing) and (not ThrowingGrenade) then
  3558. CurrentSpread = (
  3559. Aimed and S.Spread.Aimed or
  3560. ((Idleing and (not Walking)) and S.Spread.Hipfire or S.Spread.Walking)
  3561. )
  3562. if Ammo.Value > 0 then
  3563. Ammo.Value = Ammo.Value - 1
  3564. if Humanoid.Health ~= 0 then
  3565. if Aimed and Run_Key_Pressed and S.UnSteadyOnFire then
  3566. Run_Key_Pressed = false
  3567. CurrentSteadyTime = 0
  3568. end
  3569. Fire_Gun()
  3570. end
  3571. end
  3572. if Ammo.Value == 0 and S.AutoReload then
  3573. wait(0.2)
  3574. Reload()
  3575. end
  3576. wait(60 / S.FireRate)
  3577. end
  3578. CanFire = true
  3579. end
  3580. end))
  3581.  
  3582. INSERT(Connections, M2.Button1Up:connect(function()
  3583. MB1_Down = false
  3584. CurrentSpread = (
  3585. Aimed and S.Spread.Aimed or
  3586. ((Idleing and (not Walking)) and S.Spread.Hipfire or S.Spread.Walking)
  3587. )
  3588. end))
  3589.  
  3590. INSERT(Connections, M2.Button2Down:connect(function()
  3591. if S.HoldMouseOrKeyToADS then
  3592. if (not AimingIn) and (not Aimed) then
  3593. AimingIn = true
  3594. AimGun()
  3595. AimingIn = false
  3596. end
  3597. else
  3598. if Aimed then
  3599. UnAimGun()
  3600. else
  3601. AimGun()
  3602. end
  3603. end
  3604. end))
  3605.  
  3606. INSERT(Connections, M2.Button2Up:connect(function()
  3607. if S.HoldMouseOrKeyToADS then
  3608. if (not AimingOut) and Aimed then
  3609. AimingOut = true
  3610. UnAimGun()
  3611. AimingOut = false
  3612. end
  3613. end
  3614. end))
  3615.  
  3616. INSERT(Connections, M2.KeyDown:connect(KeyDown))
  3617.  
  3618. INSERT(Connections, M2.KeyUp:connect(KeyUp))
  3619.  
  3620. INSERT(Connections, RS:connect(function()
  3621. local CrossHair = Gui_Clone:WaitForChild("CrossHair")
  3622. local HitMarker = Gui_Clone:WaitForChild("HitMarker")
  3623. local HUD = Gui_Clone:WaitForChild("HUD")
  3624.  
  3625. CrossHair.Position = UDim2.new(0, M2.X, 0, M2.Y)
  3626. HitMarker.Position = UDim2.new(0, M2.X - 13, 0, M2.Y - 13)
  3627.  
  3628. local Clip_Ammo_L = HUD:WaitForChild("Ammo"):WaitForChild("Clip")
  3629. local Stored_Ammo_L = HUD:WaitForChild("Ammo"):WaitForChild("Stored")
  3630. Clip_Ammo_L.Text = Ammo.Value
  3631. Clip_Ammo_L.TextColor3 = (Ammo.Value <= (ClipSize.Value / 4) and Color3.new(1, 0.5, 0.5) or Color3.new(1, 1, 1))
  3632. Stored_Ammo_L.Text = StoredAmmo.Value
  3633. Stored_Ammo_L.TextColor3 = (StoredAmmo.Value <= (ClipSize.Value * 0.5) and Color3.new(1, 0.5, 0.5) or Color3.new(1, 1, 1))
  3634.  
  3635. local Lethal_Grenade_Num_L = HUD:WaitForChild("Grenades"):WaitForChild("Lethals"):WaitForChild("Num")
  3636. Lethal_Grenade_Num_L.Text = LethalGrenades.Value
  3637. Lethal_Grenade_Num_L.TextColor3 = (LethalGrenades.Value < 2 and Color3.new(1, 0.5, 0.5) or Color3.new(1, 1, 1))
  3638.  
  3639. local Tactical_Grenade_Num_L = HUD:WaitForChild("Grenades"):WaitForChild("Tacticals"):WaitForChild("Num")
  3640. Tactical_Grenade_Num_L.Text = TacticalGrenades.Value
  3641. Tactical_Grenade_Num_L.TextColor3 = (TacticalGrenades.Value < 2 and Color3.new(1, 0.5, 0.5) or Color3.new(1, 1, 1))
  3642.  
  3643. local Mode = HUD:WaitForChild("Mode"):WaitForChild("Main")
  3644. if S.GunType.Auto
  3645. and (not S.GunType.Semi)
  3646. and (not S.GunType.Burst)
  3647. and (not S.GunType.Explosive) then
  3648.  
  3649. Mode.Text = "Auto"
  3650.  
  3651. elseif (not S.GunType.Auto)
  3652. and S.GunType.Burst
  3653. and (not S.GunType.Explosive) then
  3654.  
  3655. Mode.Text = "Burst"
  3656.  
  3657. elseif (not S.GunType.Auto)
  3658. and S.GunType.Semi
  3659. and (not S.GunType.Explosive) then
  3660.  
  3661. Mode.Text = "Semi"
  3662.  
  3663. elseif (not S.GunType.Auto)
  3664. and (not S.GunType.Semi)
  3665. and (not S.GunType.Burst)
  3666. and S.GunType.Shot
  3667. and (not S.GunType.Explosive) then
  3668.  
  3669. Mode.Text = "Shotgun"
  3670.  
  3671. elseif (not S.GunType.Auto)
  3672. and (not S.GunType.Semi)
  3673. and S.GunType.Burst
  3674. and (not S.GunType.Shot)
  3675. and (not S.GunType.Explosive) then
  3676.  
  3677. Mode.Text = "Burst"
  3678.  
  3679. elseif S.GunType.Explosive then
  3680.  
  3681. Mode.Text = "Explosive"
  3682.  
  3683. end
  3684.  
  3685. if tick() - LastBeat > (Humanoid.Health / 75) then
  3686. LastBeat = tick()
  3687. HUD.Health.Tray.Beat:TweenPosition(
  3688. UDim2.new(0, -21, 0, 0),
  3689. Enum.EasingDirection.Out,
  3690. Enum.EasingStyle.Linear,
  3691. 0.7 - ((100 - Humanoid.Health) / 400),
  3692. false,
  3693. function()
  3694. HUD.Health.Tray.Beat.Position = UDim2.new(1, 0, 0, 0)
  3695. end
  3696. )
  3697. end
  3698.  
  3699. HUD.Health.Num.Text = CEIL(Humanoid.Health).."%"
  3700. HUD.Health.Num.TextColor3 = (
  3701. (Humanoid.Health > 200 / 3) and Color3.new(1, 1, 1) or
  3702. (Humanoid.Health <= 200 / 3 and Humanoid.Health > 100 / 3) and Color3.new(1, 1, 0) or
  3703. (Humanoid.Health <= 100 / 3) and Color3.new(1, 0, 0)
  3704. )
  3705. end))
  3706.  
  3707. INSERT(Connections, RS:connect(function()
  3708. local MDir = M2.UnitRay.Direction.unit
  3709.  
  3710. local HRPCF = HRP.CFrame * CF(0, 1.5, 0) * CF(Humanoid.CameraOffset)
  3711. Neck.C0 = Torso.CFrame:toObjectSpace(HRPCF)
  3712.  
  3713. if MDir.y == MDir.y then
  3714. HeadRot = -math.asin(MDir.y)
  3715. Neck.C1 = CFANG(HeadRot,0,0)
  3716.  
  3717. local RotTarget = VEC3(MDir.x,0,MDir.z)
  3718. local Rotation = CF(Torso.Position,Torso.Position + RotTarget)
  3719. BG.cframe = Rotation
  3720.  
  3721. local MouseX = FLOOR((M2.X - M2.ViewSizeX / 2) + 0.5)
  3722. local MouseY = FLOOR((M2.Y - M2.ViewSizeY / 2) + 0.5)
  3723. local AppliedMaxTorque = nil
  3724. if (Camera.CoordinateFrame.p - Head.Position).magnitude < 0.6 then
  3725. if (MouseX >= 50 or MouseX <= -50)
  3726. or (MouseY >= 50 or MouseY <= -50) then
  3727. AppliedMaxTorque = VEC3()
  3728. else
  3729. AppliedMaxTorque = VEC3(HUGE,HUGE,HUGE)
  3730. end
  3731. else
  3732. AppliedMaxTorque = VEC3(HUGE,HUGE,HUGE)
  3733. end
  3734. if (not S.RotateWhileSitting) and Humanoid.Sit then
  3735. AppliedMaxTorque = VEC3()
  3736. end
  3737. BG.maxTorque = AppliedMaxTorque
  3738. end
  3739. end))
  3740.  
  3741. INSERT(Connections, RS:connect(function()
  3742. local Forward = (Keys["w"] or Keys[string.char(17)])
  3743. local Backward = (Keys["s"] or Keys[string.char(18)])
  3744. local Right = (Keys["d"] or Keys[string.char(19)])
  3745. local Left = (Keys["a"] or Keys[string.char(20)])
  3746.  
  3747. local WalkingForward = (Forward and (not Backward))
  3748. local WalkingBackward = ((not Forward) and Backward)
  3749. local WalkingRight = (Right and (not Left))
  3750. local WalkingLeft = ((not Right) and Left)
  3751.  
  3752. ArmTilt = (
  3753. ((WalkingForward or WalkingBackward) and WalkingRight) and 5 or
  3754. ((WalkingForward or WalkingBackward) and WalkingLeft) and -5 or
  3755. ((not (WalkingForward and WalkingBackward)) and WalkingRight) and 10 or
  3756. ((not (WalkingForward and WalkingBackward)) and WalkingLeft) and -10 or 0
  3757. )
  3758. end))
  3759.  
  3760. INSERT(Connections, RS:connect(function()
  3761. if (not Idleing) and Walking then
  3762. if Running then
  3763. Humanoid.WalkSpeed = S.SprintSpeed
  3764. else
  3765. local SpeedRatio = (S.AimedWalkSpeed / S.BaseWalkSpeed)
  3766. if Stance == 0 then
  3767. Humanoid.WalkSpeed = (Aimed and S.AimedWalkSpeed or S.BaseWalkSpeed)
  3768. elseif Stance == 1 then
  3769. Humanoid.WalkSpeed = (Aimed and S.CrouchWalkSpeed * SpeedRatio or S.CrouchWalkSpeed)
  3770. elseif Stance == 2 then
  3771. Humanoid.WalkSpeed = (Aimed and S.ProneWalkSpeed * SpeedRatio or S.ProneWalkSpeed)
  3772. end
  3773. end
  3774. else
  3775. Humanoid.WalkSpeed = 16
  3776. end
  3777.  
  3778. StanceSway = 1 - (0.25 * Stance)
  3779. end))
  3780.  
  3781. --------------------[ ANIMATE GUN ]-------------------------------------------
  3782.  
  3783. Animate()
  3784. end
  3785. end
  3786.  
  3787.  
  3788. function OnUnequipped(DeleteTool)
  3789. if Selected then
  3790. Selected = false
  3791.  
  3792. BreakReload = true
  3793.  
  3794. --------------------[ MODIFYING THE PLAYER ]----------------------------------
  3795.  
  3796. Camera.FieldOfView = 90
  3797.  
  3798. game:GetService("UserInputService").MouseIconEnabled = true
  3799.  
  3800. Gui_Clone:Destroy()
  3801. BG:Destroy()
  3802.  
  3803. RArm.Transparency = 0
  3804. LArm.Transparency = 0
  3805.  
  3806. Shoulders.Right.Part1 = RArm
  3807. Shoulders.Left.Part1 = LArm
  3808.  
  3809. Neck.C0 = PrevNeckCF.C0
  3810. Neck.C1 = PrevNeckCF.C1
  3811.  
  3812. Humanoid.WalkSpeed = 16
  3813.  
  3814. --------------------[ RESETING THE TOOL ]-------------------------------------
  3815.  
  3816. Gun_Ignore:Destroy()
  3817.  
  3818. Aimed = false
  3819.  
  3820. for _, Tab in pairs(Parts) do
  3821. Tab.Weld:Destroy()
  3822. Tab.Weld = nil
  3823. end
  3824.  
  3825. for _,c in pairs(Connections) do
  3826. c:disconnect()
  3827. end
  3828.  
  3829. Connections = {}
  3830.  
  3831. if DeleteTool then
  3832. Camera:ClearAllChildren()
  3833. Gun:Destroy()
  3834. end
  3835.  
  3836. if S.StandOnDeselect and Stance ~= 0 then Stand(true) end
  3837. end
  3838. end
  3839.  
  3840. Gun.Equipped:connect(OnEquipped)
  3841. Gun.Unequipped:connect(function() OnUnequipped(false) end)
  3842.  
  3843. --------------------------------------------------------------------------------------
  3844. --------------------[ END PROGRAM ]---------------------------------------------------
  3845. --------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement