Guest User

Untitled

a guest
Jun 20th, 2022
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 134.19 KB | None | 0 0
  1. local HttpService = game:GetService("HttpService")
  2. local GuiService = game:GetService("GuiService")
  3. local RunService = game:GetService("RunService")
  4. local UserInputService = game:GetService("UserInputService")
  5. local TweenService = game:GetService("TweenService")
  6. local Debris = game:GetService("Debris")
  7. local Workspace = game:GetService("Workspace")
  8. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  9. local Players = game:GetService("Players")
  10.  
  11. local Tool = script.Parent
  12. local Handle = Tool:WaitForChild("Handle")
  13. local Player = Players.LocalPlayer
  14. local Character = Workspace:WaitForChild(Player.Name)
  15. local Humanoid = Character:WaitForChild("Humanoid")
  16. local Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("UpperTorso")
  17. local PlayerGui = Player:WaitForChild("PlayerGui")
  18. local Mouse = Player:GetMouse()
  19. local Camera = Workspace.CurrentCamera
  20. local GunScript_Server = Tool:WaitForChild("GunScript_Server")
  21. local GUI = script:WaitForChild("GunGUI")
  22. local AimButton = GUI.MobileButtons.AimButton
  23. local FireButton = GUI.MobileButtons.FireButton
  24. local HoldDownButton = GUI.MobileButtons.HoldDownButton
  25. local InspectButton = GUI.MobileButtons.InspectButton
  26. local ReloadButton = GUI.MobileButtons.ReloadButton
  27. local SwitchButton = GUI.MobileButtons.SwitchButton
  28. local MeleeButton = GUI.MobileButtons.MeleeButton
  29. local CrossFrame = GUI.Crosshair.Main
  30. local CrossParts = {game.WaitForChild(CrossFrame, "HR"), game.WaitForChild(CrossFrame, "HL"), game.WaitForChild(CrossFrame, "VD"), game.WaitForChild(CrossFrame, "VU")}
  31.  
  32. local TouchGui
  33. local TouchControlFrame
  34. local JumpButton
  35. if UserInputService.TouchEnabled then
  36. TouchGui = PlayerGui:WaitForChild("TouchGui")
  37. TouchControlFrame = TouchGui:WaitForChild("TouchControlFrame")
  38. JumpButton = TouchControlFrame:WaitForChild("JumpButton")
  39. end
  40.  
  41. local MarkerEvent = script:WaitForChild("MarkerEvent")
  42. local ChangeMagAndAmmo = GunScript_Server:WaitForChild("ChangeMagAndAmmo")
  43. local InflictTargetMelee = GunScript_Server:WaitForChild("InflictTargetMelee")
  44.  
  45. local MagValue = GunScript_Server:WaitForChild("Mag")
  46. local AmmoValue = GunScript_Server:WaitForChild("Ammo")
  47. local HeatValue = GunScript_Server:WaitForChild("Heat")
  48.  
  49. local Miscs = ReplicatedStorage:WaitForChild("Miscs")
  50. local Modules = ReplicatedStorage:WaitForChild("Modules")
  51. local Remotes = ReplicatedStorage:WaitForChild("Remotes")
  52.  
  53. local GunVisualEffects = Miscs.GunVisualEffects
  54. local VisualEffects = GunVisualEffects[Tool.Name]
  55.  
  56. local Module = require(Tool:WaitForChild("Setting"))
  57. local ViewmodelHandler = require(Modules.ViewmodelHandler)
  58. local ProjectileHandler = require(Modules.ProjectileHandler)
  59. local MuzzleHandler = require(Modules.MuzzleHandler)
  60. local AudioHandler = require(Modules.AudioHandler)
  61. local SmokeTrail = require(Modules.SmokeTrail)
  62. local DamageModule = require(Modules.DamageModule)
  63. local Utilities = require(Modules.Utilities)
  64. local Thread = Utilities.Thread
  65. local ProjectileMotion = Utilities.ProjectileMotion
  66. local Math = Utilities.Math
  67.  
  68. local ShatterGlass = Remotes.ShatterGlass
  69.  
  70. local BindToStepName = "UpdateGun_"..HttpService:GenerateGUID()
  71.  
  72. --Viewmodel
  73. local Viewmodel
  74. local FakeCamera
  75. local VMHandle
  76. local VMHandle2
  77. local VMHandleToFire
  78. local VMHandleCounts = 1
  79. local CFAngles
  80. --
  81. local Grip2
  82. local Handle2
  83. local HandleToFire = Handle
  84. local Beam, Attach0, Attach1
  85. local LockedEntity
  86. local Animations = {}
  87. local VMAnimations = {}
  88. local Keyframes = {}
  89. local KeyframeConnections = {}
  90. local VMKeyframes = {}
  91. local VMKeyframeConnections = {}
  92. local TwoDeeShells = {}
  93.  
  94. if Module.MagCartridge and not Module.BatteryEnabled and Module.AmmoPerMag ~= math.huge then
  95. for i = 1, Module.AmmoPerMag do
  96. local Bullet = GUI.MagCartridge.UIGridLayout.Template:Clone()
  97. Bullet.Name = i
  98. Bullet.LayoutOrder = i
  99. Bullet.Parent = GUI.MagCartridge
  100. end
  101. end
  102.  
  103. local Spring = Utilities.Spring
  104. local OldPosition = Vector2.new()
  105.  
  106. --scope
  107.  
  108. --for the scope wiggle
  109. local Scope = Spring.spring.new(Vector3.new(0, 200, 0))
  110. Scope.s = Module.ScopeSwaySpeed
  111. Scope.d = Module.ScopeSwayDamper
  112. --for the knockback wiggle
  113. local Knockback = Spring.spring.new(Vector3.new())
  114. Knockback.s = Module.ScopeKnockbackSpeed
  115. Knockback.d = Module.ScopeKnockbackDamper
  116.  
  117. --camera
  118.  
  119. local CameraSpring = Spring.spring.new(Vector3.new())
  120. CameraSpring.s = Module.RecoilSpeed
  121. CameraSpring.d = Module.RecoilDamper
  122.  
  123. --crosshair
  124.  
  125. local CrossScale = Spring.spring.new(0)
  126. CrossScale.s = 10
  127. CrossScale.d = 0.8
  128. CrossScale.t = 1
  129. local CrossSpring = Spring.spring.new(0)
  130. CrossSpring.s = 12
  131. CrossSpring.d = 0.65
  132.  
  133. if Module.DualEnabled then
  134. Handle2 = Tool:WaitForChild("Handle2", 2)
  135. if Handle2 == nil and Module.DualEnabled then error("\"Dual\" setting is enabled but \"Handle2\" is missing!") end
  136. end
  137.  
  138. local TopbarOffset = (GUI.IgnoreGuiInset and GuiService:GetGuiInset()) or Vector2.new(0, 0)
  139. local Killzone = GUI.AbsoluteSize.Y + TopbarOffset.Y + 100
  140. local TargetMarker = script:WaitForChild("TargetMarker"):Clone()
  141. local Variables = {
  142. Equipped = false;
  143. ActuallyEquipped = false;
  144. Enabled = true;
  145. Down = false;
  146. HoldDown = false;
  147. Reloading = false;
  148. AimDown = false;
  149. Scoping = false;
  150. Inspecting = false;
  151. Charging = false;
  152. Charged = false;
  153. Switching = false;
  154. Overheated = false;
  155. CanBeCooledDown = true;
  156. Mag = MagValue.Value;
  157. Ammo = AmmoValue.Value;
  158. Heat = HeatValue.Value;
  159. MaxAmmo = Module.MaxAmmo;
  160. CurrentRate = 0;
  161. LastRate = 0;
  162. ElapsedTime = 0;
  163. ElapsedCooldownTime = 0;
  164. ChargeLevel = 0;
  165. FireModes = Module.FireModes;
  166. FireMode = 1;
  167. ShotsForDepletion = 0;
  168. ShotID = 0;
  169. twoDeeShellCount = 0;
  170. InitialSensitivity = UserInputService.MouseDeltaSensitivity;
  171. }
  172.  
  173. local function FindAnimationNameForKeyframe(AnimObject, IsViewmodel)
  174. if IsViewmodel then
  175. if Module.VMAnimationKeyframes[AnimObject.Name] then
  176. table.insert(VMKeyframes, {AnimObject, Module.VMAnimationKeyframes[AnimObject.Name]})
  177. end
  178. else
  179. if Module.AnimationKeyframes[AnimObject.Name] then
  180. table.insert(Keyframes, {AnimObject, Module.AnimationKeyframes[AnimObject.Name]})
  181. end
  182. end
  183. end
  184.  
  185. if Module.IdleAnimationID ~= nil or Module.DualEnabled then
  186. Animations.IdleAnim = Tool:WaitForChild("IdleAnim")
  187. Animations.IdleAnim = Humanoid:LoadAnimation(Animations.IdleAnim)
  188. FindAnimationNameForKeyframe(Animations.IdleAnim)
  189. end
  190. if Module.FireAnimationID ~= nil then
  191. Animations.FireAnim = Tool:WaitForChild("FireAnim")
  192. Animations.FireAnim = Humanoid:LoadAnimation(Animations.FireAnim)
  193. FindAnimationNameForKeyframe(Animations.FireAnim)
  194. end
  195. if Module.ReloadAnimationID ~= nil then
  196. Animations.ReloadAnim = Tool:WaitForChild("ReloadAnim")
  197. Animations.ReloadAnim = Humanoid:LoadAnimation(Animations.ReloadAnim)
  198. FindAnimationNameForKeyframe(Animations.ReloadAnim)
  199. --wait(0.85)
  200. --script.Parent.M416.Mag.Transparency = 1
  201. --wait(0.15)
  202. --script.Parent.M416.Mag.Transparency = 0
  203. end
  204. if Module.ShotgunClipinAnimationID ~= nil then
  205. Animations.ShotgunClipinAnim = Tool:WaitForChild("ShotgunClipinAnim")
  206. Animations.ShotgunClipinAnim = Humanoid:LoadAnimation(Animations.ShotgunClipinAnim)
  207. FindAnimationNameForKeyframe(Animations.ShotgunClipinAnim)
  208. end
  209. if Module.ShotgunPumpinAnimationID ~= nil then
  210. Animations.ShotgunPumpinAnim = Tool:WaitForChild("ShotgunPumpinAnim")
  211. Animations.ShotgunPumpinAnim = Humanoid:LoadAnimation(Animations.ShotgunPumpinAnim)
  212. FindAnimationNameForKeyframe(Animations.ShotgunPumpinAnim)
  213. end
  214. if Module.SecondaryShotgunPumpinAnimationID ~= nil then
  215. Animations.SecondaryShotgunPumpinAnim = Tool:WaitForChild("SecondaryShotgunPumpinAnim")
  216. Animations.SecondaryShotgunPumpinAnim = Humanoid:LoadAnimation(Animations.SecondaryShotgunPumpinAnim)
  217. FindAnimationNameForKeyframe(Animations.SecondaryShotgunPumpinAnim)
  218. end
  219. if Module.HoldDownAnimationID ~= nil then
  220. Animations.HoldDownAnim = Tool:WaitForChild("HoldDownAnim")
  221. Animations.HoldDownAnim = Humanoid:LoadAnimation(Animations.HoldDownAnim)
  222. FindAnimationNameForKeyframe(Animations.HoldDownAnim)
  223. end
  224. if Module.EquippedAnimationID ~= nil then
  225. Animations.EquippedAnim = Tool:WaitForChild("EquippedAnim")
  226. Animations.EquippedAnim = Humanoid:LoadAnimation(Animations.EquippedAnim)
  227. FindAnimationNameForKeyframe(Animations.EquippedAnim)
  228. end
  229. if Module.SecondaryFireAnimationEnabled and Module.SecondaryFireAnimationID ~= nil then
  230. Animations.SecondaryFireAnim = Tool:WaitForChild("SecondaryFireAnim")
  231. Animations.SecondaryFireAnim = Humanoid:LoadAnimation(Animations.SecondaryFireAnim)
  232. FindAnimationNameForKeyframe(Animations.SecondaryFireAnim)
  233. end
  234. if Module.AimAnimationsEnabled and Module.AimIdleAnimationID ~= nil then
  235. Animations.AimIdleAnim = Tool:WaitForChild("AimIdleAnim")
  236. Animations.AimIdleAnim = Humanoid:LoadAnimation(Animations.AimIdleAnim)
  237. FindAnimationNameForKeyframe(Animations.AimIdleAnim)
  238. end
  239. if Module.AimAnimationsEnabled and Module.AimFireAnimationID ~= nil then
  240. Animations.AimFireAnim = Tool:WaitForChild("AimFireAnim")
  241. Animations.AimFireAnim = Humanoid:LoadAnimation(Animations.AimFireAnim)
  242. FindAnimationNameForKeyframe(Animations.AimFireAnim)
  243. end
  244. if Module.AimAnimationsEnabled and Module.AimSecondaryFireAnimationID ~= nil then
  245. Animations.AimSecondaryFireAnim = Tool:WaitForChild("AimSecondaryFireAnim")
  246. Animations.AimSecondaryFireAnim = Humanoid:LoadAnimation(Animations.AimSecondaryFireAnim)
  247. FindAnimationNameForKeyframe(Animations.AimSecondaryFireAnim)
  248. end
  249. if Module.AimAnimationsEnabled and Module.AimChargingAnimationID ~= nil then
  250. Animations.AimChargingAnim = Tool:WaitForChild("AimChargingAnim")
  251. Animations.AimChargingAnim = Humanoid:LoadAnimation(Animations.AimChargingAnim)
  252. FindAnimationNameForKeyframe(Animations.AimChargingAnim)
  253. end
  254. if Module.TacticalReloadAnimationEnabled and Module.TacticalReloadAnimationID ~= nil then
  255. Animations.TacticalReloadAnim = Tool:WaitForChild("TacticalReloadAnim")
  256. Animations.TacticalReloadAnim = Humanoid:LoadAnimation(Animations.TacticalReloadAnim)
  257. FindAnimationNameForKeyframe(Animations.TacticalReloadAnim)
  258. end
  259. if Module.InspectAnimationEnabled and Module.InspectAnimationID ~= nil then
  260. Animations.InspectAnim = Tool:WaitForChild("InspectAnim")
  261. Animations.InspectAnim = Humanoid:LoadAnimation(Animations.InspectAnim)
  262. FindAnimationNameForKeyframe(Animations.InspectAnim)
  263. end
  264. if Module.ShotgunReload and Module.PreShotgunReload and Module.PreShotgunReloadAnimationID ~= nil then
  265. Animations.PreShotgunReloadAnim = Tool:WaitForChild("PreShotgunReloadAnim")
  266. Animations.PreShotgunReloadAnim = Humanoid:LoadAnimation(Animations.PreShotgunReloadAnim)
  267. FindAnimationNameForKeyframe(Animations.PreShotgunReloadAnim)
  268. end
  269. if Module.MinigunRevUpAnimationID ~= nil then
  270. Animations.MinigunRevUpAnim = Tool:WaitForChild("MinigunRevUpAnim")
  271. Animations.MinigunRevUpAnim = Humanoid:LoadAnimation(Animations.MinigunRevUpAnim)
  272. FindAnimationNameForKeyframe(Animations.MinigunRevUpAnim)
  273. end
  274. if Module.MinigunRevDownAnimationID ~= nil then
  275. Animations.MinigunRevDownAnim = Tool:WaitForChild("MinigunRevDownAnim")
  276. Animations.MinigunRevDownAnim = Humanoid:LoadAnimation(Animations.MinigunRevDownAnim)
  277. FindAnimationNameForKeyframe(Animations.MinigunRevDownAnim)
  278. end
  279. if Module.ChargingAnimationEnabled and Module.ChargingAnimationID ~= nil then
  280. Animations.ChargingAnim = Tool:WaitForChild("ChargingAnim")
  281. Animations.ChargingAnim = Humanoid:LoadAnimation(Animations.ChargingAnim)
  282. FindAnimationNameForKeyframe(Animations.ChargingAnim)
  283. end
  284. if Module.SelectiveFireEnabled and Module.SwitchAnimationID ~= nil then
  285. Animations.SwitchAnim = Tool:WaitForChild("SwitchAnim")
  286. Animations.SwitchAnim = Humanoid:LoadAnimation(Animations.SwitchAnim)
  287. FindAnimationNameForKeyframe(Animations.SwitchAnim)
  288. end
  289. if Module.BatteryEnabled and Module.OverheatAnimationID ~= nil then
  290. Animations.OverheatAnim = Tool:WaitForChild("OverheatAnim")
  291. Animations.OverheatAnim = Humanoid:LoadAnimation(Animations.OverheatAnim)
  292. FindAnimationNameForKeyframe(Animations.OverheatAnim)
  293. end
  294. if Module.MeleeAttackEnabled and Module.MeleeAttackAnimationID ~= nil then
  295. Animations.MeleeAttackAnim = Tool:WaitForChild("MeleeAttackAnim")
  296. Animations.MeleeAttackAnim = Humanoid:LoadAnimation(Animations.MeleeAttackAnim)
  297. FindAnimationNameForKeyframe(Animations.MeleeAttackAnim)
  298. end
  299.  
  300. local CurrentAimFireAnim
  301. local CurrentAimFireAnimationSpeed
  302. if Module.AimAnimationsEnabled then
  303. CurrentAimFireAnim = Animations.AimFireAnim
  304. CurrentAimFireAnimationSpeed = Module.AimFireAnimationSpeed
  305. end
  306. local CurrentFireAnim = Animations.FireAnim
  307. local CurrentFireAnimationSpeed = Module.FireAnimationSpeed
  308. local CurrentShotgunPumpinAnim = Animations.ShotgunPumpinAnim
  309. local CurrentShotgunPumpinAnimationSpeed = Module.ShotgunPumpinSpeed
  310.  
  311. --Viewmodel
  312. local CurrentVMFireAnim
  313. local CurrentVMFireAnimationSpeed
  314. local CurrentVMShotgunPumpinAnim
  315. local CurrentVMShotgunPumpinAnimationSpeed
  316.  
  317. local function SetCrossScale(Scale)
  318. CrossScale.t = Scale
  319. end
  320.  
  321. local function SetCrossSize(Size)
  322. CrossSpring.t = Size
  323. end
  324.  
  325. local function SetCrossSettings(Size, Speed, Damper)
  326. CrossSpring.t = Size
  327. CrossSpring.s = Speed
  328. CrossSpring.d = Damper
  329. end
  330.  
  331. local function Random2DDirection(Velocity, X, Y)
  332. return Vector2.new(X, Y) * (Velocity or 1)
  333. end
  334.  
  335. local function AddressTableValue(v1, v2)
  336. if v1 ~= nil and Module.ChargedShotAdvanceEnabled then
  337. return ((Variables.ChargeLevel == 1 and v1.Level1) or (Variables.ChargeLevel == 2 and v1.Level2) or (Variables.ChargeLevel == 3 and v1.Level3) or v2)
  338. else
  339. return v2
  340. end
  341. end
  342.  
  343. local function PopulateHumanoids(mdl)
  344. if mdl.ClassName == "Humanoid" then
  345. if DamageModule.CanDamage(mdl.Parent, Character, Module.FriendlyFire) then
  346. table.insert(Humanoids, mdl)
  347. end
  348. end
  349. for i2, mdl2 in ipairs(mdl:GetChildren()) do
  350. PopulateHumanoids(mdl2)
  351. end
  352. end
  353.  
  354. local function CastRay(StartPos, Direction, Length)
  355. local Hit, EndPos = Workspace:FindPartOnRayWithIgnoreList(Ray.new(StartPos,Direction * Length), {Camera, Tool.Parent})
  356. if Hit then
  357. local FirePointObject = (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 and VMHandleToFire:FindFirstChild("GunFirePoint") or HandleToFire:FindFirstChild("GunFirePoint")
  358. if FirePointObject ~= nil then
  359. local TipCFrame = FirePointObject.WorldCFrame
  360. local TipPos = TipCFrame.Position
  361. local TipDir = TipCFrame.LookVector
  362. local AmountToCheatBack = math.abs((Character.Head.Position - TipPos):Dot(TipDir)) + 1
  363. local GunRay = Ray.new(TipPos - TipDir.Unit * AmountToCheatBack, TipDir.Unit * AmountToCheatBack)
  364. local HitPart, HitPoint = Workspace:FindPartOnRayWithIgnoreList(GunRay, {Camera, Tool.Parent}, false, true)
  365. if HitPart and math.abs((TipPos - HitPoint).Magnitude) > 0 then
  366. return CastRay(EndPos + (Direction * 0.01), Direction, Length - ((StartPos - EndPos).Magnitude))
  367. end
  368. end
  369. end
  370. return EndPos
  371. end
  372.  
  373. local function Get3DPosition(CurrentPosOnScreen)
  374. local InputRay = Camera:ScreenPointToRay(CurrentPosOnScreen.X, CurrentPosOnScreen.Y)
  375. local EndPos = InputRay.Origin + InputRay.Direction
  376. return CastRay(Camera.CFrame.p, (EndPos - Camera.CFrame.p).Unit, 5000)
  377. end
  378.  
  379. local function FindNearestEntity()
  380. Humanoids = {}
  381. PopulateHumanoids(workspace)
  382. local MinOffset
  383. local TargetModel = nil
  384. local TargetHumanoid = nil
  385. local TargetTorso = nil
  386. for i, v in ipairs(Humanoids) do
  387. local torso = v.Parent:FindFirstChild("HumanoidRootPart") or v.Parent:FindFirstChild("Torso") or v.Parent:FindFirstChild("UpperTorso")
  388. if v and torso then
  389. local Dist = (Character.Head.Position - torso.Position).Magnitude
  390. local MousePos = Get3DPosition(GUI.Crosshair.AbsolutePosition)
  391. local MouseDirection = (MousePos - Character.Head.Position).Unit
  392. local Offset = (((MouseDirection * Dist) + Character.Head.Position) - torso.Position).Magnitude
  393. if Offset < Module.LockOnRadius and (not MinOffset or Offset < MinOffset) and v.Health > 0 then
  394. if DamageModule.CanDamage(v.Parent, Character, Module.FriendlyFire) then
  395. TargetModel = v.Parent
  396. TargetHumanoid = v
  397. TargetTorso = torso
  398. end
  399. end
  400. end
  401. end
  402. return TargetModel, TargetHumanoid, TargetTorso
  403. end
  404.  
  405. local function WorldToScreen(Viewpoint)
  406. local ToObjectSpace = Camera.CFrame:pointToObjectSpace(Viewpoint)
  407. local FieldOfView = math.tan(math.rad(Camera.FieldOfView) / 2)
  408. return Vector2.new(Camera.ViewportSize.X * (0.5 + 0.5 * (ToObjectSpace.X / ToObjectSpace.Z / -(Camera.ViewportSize.X / Camera.ViewportSize.Y * FieldOfView))), Camera.ViewportSize.Y * (0.5 + 0.5 * (ToObjectSpace.Y / ToObjectSpace.Z / FieldOfView)))
  409. end
  410.  
  411. local function UpdateGUI()
  412. GUI.Frame.Mag.Fill:TweenSize(UDim2.new(Variables.Mag / Module.AmmoPerMag, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.25, true)
  413. GUI.Frame.Ammo.Fill:TweenSize(UDim2.new(Variables.Ammo / Module.MaxAmmo, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.25, true)
  414. GUI.Frame.Heat.Fill:TweenSize(UDim2.new(Variables.Heat / Module.MaxHeat, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.25, true)
  415. GUI.Frame.Mag.Current.Text = Variables.Mag
  416. GUI.Frame.Mag.Max.Text = Module.AmmoPerMag
  417. GUI.Frame.Mag.FireMode.Text = Module.FireModeTexts[Variables.FireMode]
  418. GUI.Frame.Ammo.Current.Text = Variables.Ammo
  419. GUI.Frame.Ammo.Max.Text = Module.MaxAmmo
  420. GUI.Frame.Heat.Current.Text = Variables.Heat
  421. GUI.Frame.Heat.Max.Text = Module.MaxHeat
  422. GUI.Frame.Heat.FireMode.Text = Module.FireModeTexts[Variables.FireMode]
  423.  
  424. GUI.Frame.Mag.Current.Visible = not Variables.Reloading
  425. GUI.Frame.Mag.Max.Visible = not Variables.Reloading
  426. GUI.Frame.Mag.Frame.Visible = not Variables.Reloading
  427. GUI.Frame.Mag.Reloading.Visible = Variables.Reloading
  428. GUI.Frame.Mag.FireMode.Visible = Module.SelectiveFireEnabled
  429.  
  430. GUI.Frame.Ammo.Current.Visible = not (Variables.Ammo <= 0)
  431. GUI.Frame.Ammo.Max.Visible = not (Variables.Ammo <= 0)
  432. GUI.Frame.Ammo.Frame.Visible = not (Variables.Ammo <= 0)
  433. GUI.Frame.Ammo.NoMoreAmmo.Visible = (Variables.Ammo <= 0)
  434.  
  435. GUI.Frame.Heat.Visible = Module.BatteryEnabled
  436. GUI.Frame.Heat.Current.Visible = not Variables.Overheated
  437. GUI.Frame.Heat.Max.Visible = not Variables.Overheated
  438. GUI.Frame.Heat.Frame.Visible = not Variables.Overheated
  439. GUI.Frame.Heat.Overheated.Visible = Variables.Overheated
  440. GUI.Frame.Heat.FireMode.Visible = Module.SelectiveFireEnabled
  441.  
  442. GUI.ChargeBar.Visible = (Module.ChargedShotAdvanceEnabled or Module.HoldAndReleaseEnabled)
  443. GUI.ChargeBar.Level1.Visible = not Module.HoldAndReleaseEnabled
  444. GUI.ChargeBar.Level2.Visible = not Module.HoldAndReleaseEnabled
  445. GUI.ChargeBar.Level1.Position = UDim2.new(Module.Level1ChargingTime / Module.AdvancedChargingTime, 0, 0.5, 0)
  446. GUI.ChargeBar.Level2.Position = UDim2.new(Module.Level2ChargingTime / Module.AdvancedChargingTime, 0, 0.5, 0)
  447. GUI.ChargeBar.Position = Module.MagCartridge and UDim2.new(1, -260, 1, -70) or UDim2.new(1, -260, 1, -35)
  448.  
  449. GUI.MagCartridge.Visible = Module.MagCartridge
  450.  
  451. GUI.Frame.Mag.Visible = not Module.BatteryEnabled
  452. GUI.Frame.Ammo.Visible = Module.LimitedAmmoEnabled
  453. GUI.Frame.Heat.Visible = Module.BatteryEnabled
  454. GUI.Frame.Size = Module.LimitedAmmoEnabled and UDim2.new(0, 250, 0, 100) or UDim2.new(0, 250, 0, 55)
  455. GUI.Frame.Position = (Module.ChargedShotAdvanceEnabled or Module.HoldAndReleaseEnabled) and (Module.MagCartridge and (Module.LimitedAmmoEnabled and UDim2.new(1, -260, 1, -190) or UDim2.new(1,-260,1,-140)) or (Module.LimitedAmmoEnabled and UDim2.new(1, -260, 1, -150) or UDim2.new(1, -260, 1, -105))) or (Module.MagCartridge and (Module.LimitedAmmoEnabled and UDim2.new(1, -260, 1, -150) or UDim2.new(1, -260, 1, -105)) or (Module.LimitedAmmoEnabled and UDim2.new(1, -260, 1, -110) or UDim2.new(1, -260, 1, -65)))
  456.  
  457. GUI.MobileButtons.Visible = UserInputService.TouchEnabled --For mobile version
  458. AimButton.Visible = Module.SniperEnabled or Module.IronsightEnabled
  459. HoldDownButton.Visible = Module.HoldDownEnabled
  460. InspectButton.Visible = Module.InspectAnimationEnabled
  461. SwitchButton.Visible = Module.SelectiveFireEnabled
  462. ReloadButton.Visible = not Module.BatteryEnabled
  463. MeleeButton.Visible = Module.MeleeAttackEnabled
  464. end
  465.  
  466. local function RenderScope()
  467. Knockback.t = Knockback.t:Lerp(Vector3.new(), 0.2)
  468. end
  469.  
  470. local function RenderMouse()
  471. local Delta = UserInputService:GetMouseDelta() / Module.ScopeSensitive
  472. local Offset = GUI.Scope.AbsoluteSize.X * 0.5
  473.  
  474. if Variables.Scoping and UserInputService.MouseEnabled and UserInputService.KeyboardEnabled then --For pc version
  475. GUI.Scope.Position = UDim2.new(0, Scope.p.X + (Knockback.p.Y * 1000), 0, Scope.p.Y + (Knockback.p.X * 200))
  476. Scope.t = Vector3.new(Mouse.X - Offset - Delta.X, Mouse.Y - Offset - Delta.Y, 0)
  477. OldPosition = Vector2.new(Mouse.X, Mouse.Y)
  478. elseif Variables.Scoping and UserInputService.TouchEnabled and not UserInputService.MouseEnabled and not UserInputService.KeyboardEnabled then --For mobile version, but in first-person view
  479. GUI.Scope.Position = UDim2.new(0, Scope.p.X + (Knockback.p.Y * 1000), 0, Scope.p.Y + (Knockback.p.X * 200))
  480. Scope.t = Vector3.new(GUI.Crosshair.AbsolutePosition.X - Offset - Delta.X, GUI.Crosshair.AbsolutePosition.Y - Offset - Delta.Y, 0)
  481. OldPosition = Vector2.new(GUI.Crosshair.AbsolutePosition.X, GUI.Crosshair.AbsolutePosition.Y)
  482. end
  483.  
  484. GUI.Scope.Visible = Variables.Scoping
  485. if not Variables.Scoping then
  486. GUI.Crosshair.Main.Visible = true
  487. Scope.t = Vector3.new(600, 200, 0)
  488. else
  489. GUI.Crosshair.Main.Visible = false
  490. end
  491.  
  492. if UserInputService.MouseEnabled and UserInputService.KeyboardEnabled then --For pc version
  493. if FakeCamera then
  494. CFAngles = CFrame.fromEulerAnglesXYZ(FakeCamera.Transform:ToEulerAnglesXYZ()) or CFrame.new()
  495. if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 then
  496. if CFAngles then
  497. local v = WorldToScreen((Camera.CFrame * CFAngles:Inverse() * CFrame.new(0, 0, -4)).Position)
  498. local v2 = Camera.ViewportSize / 2
  499. GUI.Crosshair.Position = (v - v2).Magnitude > 0.08 and UDim2.new(0, v.X, 0, v.Y - 36) or UDim2.new(0, v2.X, 0, v2.Y - 36)
  500. else
  501. GUI.Crosshair.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y)
  502. end
  503. else
  504. GUI.Crosshair.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y)
  505. end
  506. else
  507. GUI.Crosshair.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y)
  508. end
  509. elseif UserInputService.TouchEnabled and not UserInputService.MouseEnabled and not UserInputService.KeyboardEnabled and (Character.Head.Position - Camera.CoordinateFrame.p).Magnitude > 2 then --For mobile version, but in third-person view
  510. GUI.Crosshair.Position = UDim2.new(0.5, 0, 0.4, -50)
  511. elseif UserInputService.TouchEnabled and not UserInputService.MouseEnabled and not UserInputService.KeyboardEnabled and (Character.Head.Position - Camera.CoordinateFrame.p).Magnitude <= 2 then --For mobile version, but in first-person view
  512. if FakeCamera then
  513. CFAngles = CFrame.fromEulerAnglesXYZ(FakeCamera.Transform:ToEulerAnglesXYZ()) or CFrame.new()
  514. if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 then
  515. if CFAngles then
  516. local v = WorldToScreen((Camera.CFrame * CFAngles:Inverse() * CFrame.new(0, 0, -4)).Position)
  517. local v2 = Camera.ViewportSize / 2
  518. GUI.Crosshair.Position = (v - v2).Magnitude > 0.08 and UDim2.new(0, v.X, 0, v.Y - 36) or UDim2.new(0, v2.X, 0, v2.Y - 36)
  519. else
  520. GUI.Crosshair.Position = UDim2.new(0.5, 0, 0.5, -19)
  521. end
  522. else
  523. GUI.Crosshair.Position = UDim2.new(0.5, 0, 0.5, -19)
  524. end
  525. else
  526. GUI.Crosshair.Position = UDim2.new(0.5, 0, 0.5, -19)
  527. end
  528. end
  529.  
  530. if AddressTableValue(Module.ChargeAlterTable.Homing, Module.Homing) and Module.LockOnOnHovering and not Module.HitscanMode then
  531. local TargetEntity, TargetHumanoid, TargetTorso = FindNearestEntity()
  532. if TargetEntity and TargetHumanoid and TargetTorso then
  533. LockedEntity = TargetEntity
  534. TargetMarker.Parent = GUI
  535. TargetMarker.Adornee = TargetTorso
  536. TargetMarker.Enabled = true
  537. else
  538. LockedEntity = nil
  539. TargetMarker.Enabled = false
  540. TargetMarker.Parent = nil
  541. TargetMarker.Adornee = nil
  542. end
  543. end
  544. end
  545.  
  546. local function RenderCam()
  547. Camera.CoordinateFrame = Camera.CoordinateFrame * CFrame.Angles(CameraSpring.p.X, CameraSpring.p.Y, CameraSpring.p.Z)
  548. end
  549.  
  550. local function RenderCrosshair()
  551. local Size = CrossSpring.p * 4 * CrossScale.p --* (char.speed / 14 * (1 - 0.8) * 2 + 0.8)*(char.sprint + 1) / 2
  552. for i = 1, 4 do
  553. CrossParts[i].BackgroundTransparency = 1 - Size / 20
  554. end
  555. CrossParts[1].Position = UDim2.new(0, Size, 0, 0)
  556. CrossParts[2].Position = UDim2.new(0, -Size - 7, 0, 0)
  557. CrossParts[3].Position = UDim2.new(0, 0, 0, Size)
  558. CrossParts[4].Position = UDim2.new(0, 0, 0, -Size - 7)
  559. end
  560.  
  561. local function RenderRate(dt)
  562. Variables.ElapsedTime = Variables.ElapsedTime + dt
  563. if Variables.ElapsedTime >= 1 then
  564. Variables.ElapsedTime = 0
  565. Variables.CurrentRate = Variables.CurrentRate - Variables.LastRate
  566. Variables.LastRate = Variables.CurrentRate
  567. end
  568. end
  569.  
  570. local function RenderMotion()
  571. local Position = Get3DPosition(GUI.Crosshair.AbsolutePosition)
  572. local cframe = (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 and CFrame.new(VMHandleToFire:FindFirstChild("GunFirePoint").WorldPosition, Position) or CFrame.new(HandleToFire:FindFirstChild("GunFirePoint").WorldPosition, Position)
  573. local direction = cframe.lookVector
  574.  
  575. if direction then
  576. ProjectileMotion.UpdateProjectilePath(Beam, Attach0, Attach1, (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 and VMHandleToFire:FindFirstChild("GunFirePoint").WorldPosition or HandleToFire:FindFirstChild("GunFirePoint").WorldPosition, direction * AddressTableValue(Module.ChargeAlterTable.BulletSpeed, Module.BulletSpeed), 3, AddressTableValue(Module.ChargeAlterTable.BulletAcceleration, Module.BulletAcceleration))
  577. end
  578. end
  579.  
  580. local function RenderCooldown(dt)
  581. Variables.ElapsedCooldownTime = Variables.ElapsedCooldownTime + dt
  582. if Variables.ElapsedCooldownTime >= Module.CooldownTime then
  583. Variables.ElapsedCooldownTime = 0
  584. if not Variables.Down then
  585. if not Variables.Overheated then
  586. if Variables.CanBeCooledDown then
  587. if Variables.Heat > 0 then
  588. Variables.Heat = math.clamp(Variables.Heat - Module.CooldownRate, 0, Module.MaxHeat)
  589. UpdateGUI()
  590. ChangeMagAndAmmo:FireServer(Variables.Mag, Variables.Ammo, Variables.Heat)
  591. end
  592. end
  593. end
  594. end
  595. end
  596. end
  597.  
  598. local function RenderTwoDeeShell(dt)
  599. local Drag = Module.Drag ^ dt
  600. for twoDeeShell, data in pairs(TwoDeeShells) do
  601. if twoDeeShell.Parent then
  602. data.Vel = (data.Vel * Drag) + Module.Gravity * dt
  603. data.Pos = data.Pos + data.Vel * dt
  604. data.RotVel = data.RotVel * Drag
  605. data.Rot = data.Rot + data.RotVel * dt
  606. twoDeeShell.Position = UDim2.new(0, data.Pos.X, 0, data.Pos.Y)
  607. twoDeeShell.Rotation = data.Rot
  608. if twoDeeShell.AbsolutePosition.Y > Killzone then
  609. twoDeeShell:Destroy()
  610. Variables.twoDeeShellCount = Variables.twoDeeShellCount - 1
  611. TwoDeeShells[twoDeeShell] = nil
  612. end
  613. else
  614. Variables.twoDeeShellCount = Variables.twoDeeShellCount - 1
  615. TwoDeeShells[twoDeeShell] = nil
  616. end
  617. end
  618. end
  619.  
  620. --[[local function RenderScopeOLD(dt)
  621. if Variables.Scoping and UserInputService.MouseEnabled and UserInputService.KeyboardEnabled then --For pc version
  622. GUI.Scope.Size = UDim2.new(Math.Lerp(GUI.Scope.Size.X.Scale, 1.2, math.min(dt * 5, 1)), 36, Math.Lerp(GUI.Scope.Size.Y.Scale, 1.2, math.min(dt * 5, 1)), 36)
  623. GUI.Scope.Position = UDim2.new(0, Mouse.X - GUI.Scope.AbsoluteSize.X / 2, 0, Mouse.Y - GUI.Scope.AbsoluteSize.Y / 2)
  624. elseif Variables.Scoping and UserInputService.TouchEnabled and not UserInputService.MouseEnabled and not UserInputService.KeyboardEnabled then --For mobile version, but in first-person view
  625. GUI.Scope.Size = UDim2.new(Math.Lerp(GUI.Scope.Size.X.Scale, 1.2, math.min(dt * 5, 1)), 36, Math.Lerp(GUI.Scope.Size.Y.Scale, 1.2, math.min(dt * 5, 1)), 36)
  626. GUI.Scope.Position = UDim2.new(0, GUI.Crosshair.AbsolutePosition.X - GUI.Scope.AbsoluteSize.X / 2, 0, GUI.Crosshair.AbsolutePosition.Y - GUI.Scope.AbsoluteSize.Y / 2)
  627. else
  628. GUI.Scope.Size = UDim2.new(0.6, 36, 0.6, 36)
  629. GUI.Scope.Position = UDim2.new(0, 0, 0, 0)
  630. end
  631.  
  632. GUI.Scope.Visible = Variables.Scoping
  633.  
  634. if UserInputService.MouseEnabled and UserInputService.KeyboardEnabled then --For pc version
  635. GUI.Crosshair.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y)
  636. elseif UserInputService.TouchEnabled and not UserInputService.MouseEnabled and not UserInputService.KeyboardEnabled and (Character.Head.Position - Camera.CoordinateFrame.p).Magnitude > 2 then --For mobile version, but in third-person view
  637. GUI.Crosshair.Position = UDim2.new(0.5, 0, 0.4, -50)
  638. elseif UserInputService.TouchEnabled and not UserInputService.MouseEnabled and not UserInputService.KeyboardEnabled and (Character.Head.Position - Camera.CoordinateFrame.p).Magnitude <= 2 then --For mobile version, but in first-person view
  639. GUI.Crosshair.Position = UDim2.new(0.5, -1, 0.5, -19)
  640. end
  641. end]]
  642.  
  643. local function MarkHit(IsHeadshot)
  644. --pcall(function()
  645. if Module.HitmarkerEnabled then
  646. if IsHeadshot then
  647. GUI.Crosshair.Hitmarker.ImageColor3 = Module.HitmarkerColorHS
  648. GUI.Crosshair.Hitmarker.ImageTransparency = 0
  649. TweenService:Create(GUI.Crosshair.Hitmarker, TweenInfo.new(Module.HitmarkerFadeTimeHS, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {ImageTransparency = 1}):Play()
  650. local MarkerSound = GUI.Crosshair.MarkerSound:Clone()
  651. MarkerSound.SoundId = "rbxassetid://"..Module.HitmarkerSoundID[math.random(1, #Module.HitmarkerSoundID)]
  652. MarkerSound.PlaybackSpeed = Module.HitmarkerSoundPitchHS
  653. MarkerSound.Parent = Player.PlayerGui
  654. MarkerSound:Play()
  655. MarkerSound.Ended:Connect(function()
  656. MarkerSound:Destroy()
  657. end)
  658. else
  659. GUI.Crosshair.Hitmarker.ImageColor3 = Module.HitmarkerColor
  660. GUI.Crosshair.Hitmarker.ImageTransparency = 0
  661. TweenService:Create(GUI.Crosshair.Hitmarker, TweenInfo.new(Module.HitmarkerFadeTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {ImageTransparency = 1}):Play()
  662. local MarkerSound = GUI.Crosshair.MarkerSound:Clone()
  663. MarkerSound.SoundId = "rbxassetid://"..Module.HitmarkerSoundID[math.random(1, #Module.HitmarkerSoundID)]
  664. MarkerSound.PlaybackSpeed = Module.HitmarkerSoundPitch
  665. MarkerSound.Parent = Player.PlayerGui
  666. MarkerSound:Play()
  667. MarkerSound.Ended:Connect(function()
  668. MarkerSound:Destroy()
  669. end)
  670. end
  671. end
  672. --end)
  673. end
  674.  
  675. local function EjectShell(ShootingHandle)
  676. if Module.BulletShellEnabled then
  677. if Module.BulletShellParticles then
  678. local function Spawner()
  679. for i, v in pairs(VisualEffects.ShellEjectEffect:GetChildren()) do
  680. if v.ClassName == "ParticleEmitter" then
  681. local Count = 1
  682. local Particle = v:Clone()
  683. Particle.Parent = ShootingHandle.ShellEjectParticlePoint
  684. if Particle:FindFirstChild("EmitCount") then
  685. Count = Particle.EmitCount.Value
  686. end
  687. Thread:Delay(0.01, function()
  688. Particle:Emit(Count)
  689. Debris:AddItem(Particle, Particle.Lifetime.Max)
  690. end)
  691. end
  692. end
  693. end
  694. Thread:Spawn(Spawner)
  695. end
  696. local Shell = Instance.new("Part")
  697. Shell.CFrame = ShootingHandle.ShellEjectPoint.WorldCFrame
  698. Shell.Size = Module.ShellSize
  699. Shell.CanCollide = Module.AllowCollide
  700. Shell.Name = "Shell"
  701. Shell.Velocity = ShootingHandle.ShellEjectPoint.WorldCFrame.LookVector * Module.BulletShellVelocity
  702. Shell.RotVelocity = ShootingHandle.ShellEjectPoint.WorldCFrame.LookVector * Module.BulletShellRotVelocity
  703. Shell.Parent = Camera
  704. local Shellmesh = Instance.new("SpecialMesh")
  705. Shellmesh.Scale = Module.ShellScale
  706. Shellmesh.MeshId = "rbxassetid://"..Module.ShellMeshID
  707. Shellmesh.TextureId = "rbxassetid://"..Module.ShellTextureID
  708. Shellmesh.MeshType = "FileMesh"
  709. Shellmesh.Parent = Shell
  710. Debris:AddItem(Shell, Module.DisappearTime)
  711. end
  712. end
  713.  
  714. local function RecoilCamera()
  715. if Module.CameraRecoilingEnabled then
  716. local Recoil = AddressTableValue(Module.ChargeAlterTable.Recoil, Module.Recoil)
  717. local CurrentRecoil = Recoil * (Variables.AimDown and 1 - Module.RecoilRedution or 1)
  718. local RecoilX = math.rad(CurrentRecoil * Math.Randomize2(Module.AngleX_Min, Module.AngleX_Max, Module.Accuracy))
  719. local RecoilY = math.rad(CurrentRecoil * Math.Randomize2(Module.AngleY_Min, Module.AngleY_Max, Module.Accuracy))
  720. local RecoilZ = math.rad(CurrentRecoil * Math.Randomize2(Module.AngleZ_Min, Module.AngleZ_Max, Module.Accuracy))
  721. Knockback:Accelerate(Vector3.new(-RecoilX * Module.ScopeKnockbackMultiplier, -RecoilY * Module.ScopeKnockbackMultiplier, 0))
  722. CameraSpring:Accelerate(Vector3.new(RecoilX, RecoilY, RecoilZ))
  723. Thread:Wait(0.03)
  724. CameraSpring:Accelerate(Vector3.new(-RecoilX, -RecoilY, 0))
  725. end
  726. end
  727.  
  728. local function SelfKnockback(p1, p2)
  729. local SelfKnockbackPower = AddressTableValue(Module.ChargeAlterTable.SelfKnockbackPower, Module.SelfKnockbackPower)
  730. local SelfKnockbackMultiplier = AddressTableValue(Module.ChargeAlterTable.SelfKnockbackMultiplier, Module.SelfKnockbackMultiplier)
  731. local SelfKnockbackRedution = AddressTableValue(Module.ChargeAlterTable.SelfKnockbackRedution, Module.SelfKnockbackRedution)
  732. local Power = Humanoid:GetState() ~= Enum.HumanoidStateType.Freefall and SelfKnockbackPower * SelfKnockbackMultiplier * (1 - SelfKnockbackRedution) or SelfKnockbackPower * SelfKnockbackMultiplier
  733. local VelocityMod = (p1 - p2).Unit
  734. local AirVelocity = Torso.Velocity - Vector3.new(0, Torso.Velocity.Y, 0) + Vector3.new(VelocityMod.X, 0, VelocityMod.Z) * -Power
  735. local TorsoFly = Instance.new("BodyVelocity")
  736. TorsoFly.MaxForce = Vector3.new(math.huge, 0, math.huge)
  737. TorsoFly.Velocity = AirVelocity
  738. TorsoFly.Parent = Torso
  739. Torso.Velocity = Torso.Velocity + Vector3.new(0, VelocityMod.Y * 2, 0) * -Power
  740. Debris:AddItem(TorsoFly, 0.25)
  741. end
  742.  
  743. local function CreateTwoDeeShell(ObjRot, Pos, Size, Vel, type, shockwave)
  744. local MaxedOut = Variables.twoDeeShellCount >= Module.MaxCount
  745. if MaxedOut and Module.RemoveOldAtMax and math.random() then
  746. -- This is the best method I can figure for removing a random item from a dictionary of known length
  747. local RemoveCoutndown = math.random(1, Module.MaxCount)
  748. for twoDeeShell, _ in pairs(TwoDeeShells) do
  749. RemoveCoutndown = RemoveCoutndown - 1
  750. if RemoveCoutndown <= 0 then
  751. twoDeeShell:Destroy()
  752. Variables.twoDeeShellCount = Variables.twoDeeShellCount - 1
  753. TwoDeeShells[twoDeeShell] = nil
  754. MaxedOut = Variables.twoDeeShellCount >= Module.MaxCount
  755. break
  756. end
  757. end
  758. end
  759. if not MaxedOut then
  760. Variables.twoDeeShellCount = Variables.twoDeeShellCount + 1
  761. local Rot = ObjRot --math.random() * 360
  762. local XCenter = Pos.X + (Size.X / 2)
  763. local YCenter = Pos.Y + (Size.Y / 2)
  764. local Data = {
  765. RotVel = (math.random() * 2 - 1) * Module.MaxRotationSpeed,
  766. Rot = Rot,
  767. Pos = (Pos and Vector2.new(XCenter, YCenter) or Vector2.new(0, 0)) + TopbarOffset,
  768. Vel = Vel or Vector2.new(0, 0),
  769. }
  770. local TwoDeeShell = GUI.MagCartridge.UIGridLayout.Shell
  771. if type == "bullet" then
  772. TwoDeeShell = GUI.MagCartridge.UIGridLayout.Template
  773. end
  774. local Clone = TwoDeeShell:Clone()
  775. Clone.Rotation = Rot
  776. TwoDeeShells[Clone] = Data
  777. Clone.Parent = GUI
  778. if shockwave then
  779. Thread:Spawn(function()
  780. local ShockwaveClone = GUI.MagCartridge.UIGridLayout.Shockwave:Clone()
  781. local Degree = math.rad(math.random(360))
  782. ShockwaveClone.Position = UDim2.new(0, XCenter, 0, YCenter)
  783. ShockwaveClone.Rotation = math.deg(Degree)
  784. ShockwaveClone.Parent = GUI
  785. local Tween = TweenService:Create(ShockwaveClone, TweenInfo.new(0.25, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Size = UDim2.new(0, 50, 0, 50), ImageTransparency = 1})
  786. Tween:Play()
  787. Tween.Completed:Wait()
  788. ShockwaveClone:Destroy()
  789. end)
  790. end
  791. end
  792. end
  793.  
  794. local function Fire(ShootingHandle, ShootingVMHandle, FireClientDirections, FireServerDirections)
  795. ViewmodelHandler:RecoilViewmodel(Module.ViewmodelRecoilInfluence)
  796. if Module.AimAnimationsEnabled and Variables.AimDown == true then
  797. if CurrentAimFireAnim then
  798. CurrentAimFireAnim:Play(nil, nil, CurrentAimFireAnimationSpeed)
  799. end
  800. else
  801. if CurrentFireAnim then
  802. CurrentFireAnim:Play(nil, nil, CurrentFireAnimationSpeed)
  803. end
  804. end
  805. if CurrentVMFireAnim then
  806. CurrentVMFireAnim:Play(nil, nil, CurrentVMFireAnimationSpeed)
  807. end
  808. if Animations.MinigunRevUpAnim and Animations.MinigunRevUpAnim.IsPlaying then
  809. Animations.MinigunRevUpAnim:Stop()
  810. end
  811. if VMAnimations.VMMinigunRevUpAnim and VMAnimations.VMMinigunRevUpAnim.IsPlaying then
  812. VMAnimations.VMMinigunRevUpAnim:Stop()
  813. end
  814. --[[if Animations.FireAnim then
  815. Animations.FireAnim:Play(nil, nil, Module.FireAnimationSpeed)
  816. end]]
  817. --[[if VMAnimations.VMFireAnim then
  818. VMAnimations.VMFireAnim:Play(nil, nil, Module.VMFireAnimationSpeed)
  819. end]]
  820. --[[if not ShootingHandle.FireSound.Playing or not ShootingHandle.FireSound.Looped then
  821. ShootingHandle.FireSound:Play()
  822. end]]
  823. local HitEffectFolder = VisualEffects.HitEffect
  824. local BloodEffectFolder = VisualEffects.BloodEffect
  825. local ExplosionEffectFolder = VisualEffects.ExplosionEffect
  826. if Module.ChargedShotAdvanceEnabled then
  827. if Variables.ChargeLevel == 1 then
  828. if VisualEffects:FindFirstChild("HitEffectLvl1") then
  829. HitEffectFolder = VisualEffects.HitEffectLvl1
  830. else
  831. HitEffectFolder = VisualEffects.HitEffect
  832. end
  833. if VisualEffects:FindFirstChild("BloodEffectLvl1") then
  834. BloodEffectFolder = VisualEffects.BloodEffectLvl1
  835. else
  836. BloodEffectFolder = VisualEffects.BloodEffect
  837. end
  838. if VisualEffects:FindFirstChild("ExplosionEffectLvl1") then
  839. ExplosionEffectFolder = VisualEffects.ExplosionEffectLvl1
  840. else
  841. ExplosionEffectFolder = VisualEffects.ExplosionEffect
  842. end
  843. elseif Variables.ChargeLevel == 2 then
  844. if VisualEffects:FindFirstChild("HitEffectLvl2") then
  845. HitEffectFolder = VisualEffects.HitEffectLvl2
  846. else
  847. HitEffectFolder = VisualEffects.HitEffect
  848. end
  849. if VisualEffects:FindFirstChild("BloodEffectLvl2") then
  850. BloodEffectFolder = VisualEffects.BloodEffectLvl2
  851. else
  852. BloodEffectFolder = VisualEffects.BloodEffect
  853. end
  854. if VisualEffects:FindFirstChild("ExplosionEffectLvl2") then
  855. ExplosionEffectFolder = VisualEffects.ExplosionEffectLvl2
  856. else
  857. ExplosionEffectFolder = VisualEffects.ExplosionEffect
  858. end
  859. elseif Variables.ChargeLevel == 3 then
  860. if VisualEffects:FindFirstChild("HitEffectLvl3") then
  861. HitEffectFolder = VisualEffects.HitEffectLvl3
  862. else
  863. HitEffectFolder = VisualEffects.HitEffect
  864. end
  865. if VisualEffects:FindFirstChild("BloodEffectLvl3") then
  866. BloodEffectFolder = VisualEffects.BloodEffectLvl3
  867. else
  868. BloodEffectFolder = VisualEffects.BloodEffect
  869. end
  870. if VisualEffects:FindFirstChild("ExplosionEffectLvl3") then
  871. ExplosionEffectFolder = VisualEffects.ExplosionEffectLvl3
  872. else
  873. ExplosionEffectFolder = VisualEffects.ExplosionEffect
  874. end
  875. end
  876. end
  877. ProjectileHandler:SimulateProjectile(Module,Tool,ShootingHandle,
  878. (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 and ShootingVMHandle or nil,
  879. FireClientDirections,
  880. FireServerDirections,
  881. ShootingHandle:FindFirstChild("GunFirePoint"),
  882. {Module.HitEffectEnabled,AddressTableValue(Module.ChargeAlterTable.HitSoundIDs, Module.HitSoundIDs),AddressTableValue(Module.ChargeAlterTable.HitSoundPitchMin, Module.HitSoundPitchMin),AddressTableValue(Module.ChargeAlterTable.HitSoundPitchMax, Module.HitSoundPitchMax),AddressTableValue(Module.ChargeAlterTable.HitSoundVolume, Module.HitSoundVolume),HitEffectFolder,AddressTableValue(Module.ChargeAlterTable.CustomHitEffect, Module.CustomHitEffect)},
  883. {Module.BloodEnabled,AddressTableValue(Module.ChargeAlterTable.HitCharSndIDs, Module.HitCharSndIDs),AddressTableValue(Module.ChargeAlterTable.HitCharSndPitchMin, Module.HitCharSndPitchMin),AddressTableValue(Module.ChargeAlterTable.HitCharSndPitchMax, Module.HitCharSndPitchMax),AddressTableValue(Module.ChargeAlterTable.HitCharSndVolume, Module.HitCharSndVolume),BloodEffectFolder,{Module.BloodWoundEnabled, AddressTableValue(Module.ChargeAlterTable.BloodWoundSize, Module.BloodWoundSize), AddressTableValue(Module.ChargeAlterTable.BloodWoundTexture, Module.BloodWoundTexture), AddressTableValue(Module.ChargeAlterTable.BloodWoundTextureColor, Module.BloodWoundTextureColor), Module.BloodWoundVisibleTime, Module.BloodWoundFadeTime, AddressTableValue(Module.ChargeAlterTable.BloodWoundPartColor, Module.BloodWoundPartColor)}},
  884. {Module.BulletHoleEnabled,AddressTableValue(Module.ChargeAlterTable.BulletHoleSize, Module.BulletHoleSize),AddressTableValue(Module.ChargeAlterTable.BulletHoleTexture, Module.BulletHoleTexture),AddressTableValue(Module.ChargeAlterTable.PartColor, Module.PartColor),Module.BulletHoleVisibleTime,Module.BulletHoleFadeTime},
  885. {AddressTableValue(Module.ChargeAlterTable.ExplosiveEnabled, Module.ExplosiveEnabled),AddressTableValue(Module.ChargeAlterTable.ExplosionRadius, Module.ExplosionRadius),Module.ExplosionSoundEnabled,AddressTableValue(Module.ChargeAlterTable.ExplosionSoundIDs, Module.ExplosionSoundIDs),AddressTableValue(Module.ChargeAlterTable.ExplosionSoundPitchMin, Module.ExplosionSoundPitchMin),AddressTableValue(Module.ChargeAlterTable.ExplosionSoundPitchMax, Module.ExplosionSoundPitchMax),AddressTableValue(Module.ChargeAlterTable.ExplosionSoundVolume, Module.ExplosionSoundVolume),Module.CustomExplosion,ExplosionEffectFolder,Module.DamageBasedOnDistance,Module.ExplosionCraterEnabled,AddressTableValue(Module.ChargeAlterTable.ExplosionCraterSize, Module.ExplosionCraterSize),AddressTableValue(Module.ChargeAlterTable.ExplosionCraterTexture, Module.ExplosionCraterTexture),AddressTableValue(Module.ChargeAlterTable.ExplosionCraterPartColor, Module.ExplosionCraterPartColor),Module.ExplosionCraterVisibleTime,Module.ExplosionCraterFadeTime,Module.ExplosionKnockback,AddressTableValue(Module.ChargeAlterTable.ExplosionKnockbackPower, Module.ExplosionKnockbackPower),AddressTableValue(Module.ChargeAlterTable.ExplosionKnockbackMultiplierOnPlayer, Module.ExplosionKnockbackMultiplierOnPlayer),AddressTableValue(Module.ChargeAlterTable.ExplosionKnockbackMultiplierOnTarget, Module.ExplosionKnockbackMultiplierOnTarget),AddressTableValue(Module.ChargeAlterTable.SelfDamage, Module.SelfDamage),AddressTableValue(Module.ChargeAlterTable.SelfDamageRedution, Module.SelfDamageRedution),AddressTableValue(Module.ChargeAlterTable.ReduceSelfDamageOnAirOnly, Module.ReduceSelfDamageOnAirOnly)},
  886. {AddressTableValue(Module.ChargeAlterTable.BulletSpeed, Module.BulletSpeed),AddressTableValue(Module.ChargeAlterTable.BulletAcceleration, Module.BulletAcceleration),AddressTableValue(Module.ChargeAlterTable.BulletColor, Module.BulletColor),AddressTableValue(Module.ChargeAlterTable.BulletTexture, Module.BulletTexture),AddressTableValue(Module.ChargeAlterTable.BulletSize, Module.BulletSize),AddressTableValue(Module.ChargeAlterTable.BulletBloom, Module.BulletBloom),AddressTableValue(Module.ChargeAlterTable.BulletBrightness, Module.BulletBrightness),AddressTableValue(Module.ChargeAlterTable.BulletLifetime, Module.BulletLifetime),AddressTableValue(Module.ChargeAlterTable.PenetrationDepth, Module.PenetrationDepth),AddressTableValue(Module.ChargeAlterTable.RicochetAmount, Module.RicochetAmount),AddressTableValue(Module.ChargeAlterTable.BulletType, Module.BulletType),Module.CanSpinPart,AddressTableValue(Module.ChargeAlterTable.SpinX, Module.SpinX),AddressTableValue(Module.ChargeAlterTable.SpinY, Module.SpinY),AddressTableValue(Module.ChargeAlterTable.SpinZ, Module.SpinZ),AddressTableValue(Module.ChargeAlterTable.VisibleBullet, Module.VisibleBullet),AddressTableValue(Module.ChargeAlterTable.BounceElasticity, Module.BounceElasticity),AddressTableValue(Module.ChargeAlterTable.FrictionConstant, Module.FrictionConstant),Module.PenetrationType,AddressTableValue(Module.ChargeAlterTable.PenetrationAmount, Module.PenetrationAmount),AddressTableValue(Module.ChargeAlterTable.WindSpeed, Module.WindSpeed),AddressTableValue(Module.ChargeAlterTable.WindResistance, Module.WindResistance),AddressTableValue(Module.ChargeAlterTable.NoExplosionWhileBouncing, Module.NoExplosionWhileBouncing),AddressTableValue(Module.ChargeAlterTable.StopBouncingOnHitHumanoid, Module.StopBouncingOnHitHumanoid),AddressTableValue(Module.ChargeAlterTable.SuperRicochet, Module.SuperRicochet),AddressTableValue(Module.ChargeAlterTable.TouchEventOnTimeout, Module.TouchEventOnTimeout),AddressTableValue(Module.ChargeAlterTable.Homing, Module.Homing),AddressTableValue(Module.ChargeAlterTable.HomingDistance, Module.HomingDistance),AddressTableValue(Module.ChargeAlterTable.TurnRatePerSecond, Module.TurnRatePerSecond),AddressTableValue(Module.ChargeAlterTable.HomeThroughWall, Module.HomeThroughWall), Module.LockOnOnHovering, LockedEntity, Module.HitscanMode},
  887. {Module.WhizSoundEnabled,Module.WhizSoundID,Module.WhizSoundPitchMin,Module.WhizSoundPitchMax,Module.WhizDistance,Module.WhizSoundVolume},
  888. {{AddressTableValue(Module.ChargeAlterTable.BaseDamage, Module.BaseDamage),AddressTableValue(Module.ChargeAlterTable.HeadshotDamageMultiplier, Module.HeadshotDamageMultiplier),Module.HeadshotEnabled,Module.DamageDropOffEnabled,AddressTableValue(Module.ChargeAlterTable.ZeroDamageDistance, Module.ZeroDamageDistance),AddressTableValue(Module.ChargeAlterTable.FullDamageDistance, Module.FullDamageDistance),Module.FriendlyFire},
  889. {AddressTableValue(Module.ChargeAlterTable.Knockback, Module.Knockback), AddressTableValue(Module.ChargeAlterTable.Lifesteal, Module.Lifesteal), Module.Affliction, AddressTableValue(Module.ChargeAlterTable.AfflictionName, Module.AfflictionName), AddressTableValue(Module.ChargeAlterTable.AfflictChance, Module.AfflictChance)},
  890. {Module.CriticalDamageEnabled,AddressTableValue(Module.ChargeAlterTable.CriticalBaseChance, Module.CriticalBaseChance),AddressTableValue(Module.ChargeAlterTable.CriticalDamageMultiplier, Module.CriticalDamageMultiplier)},
  891. {Module.GoreEffectEnabled,Module.GoreSoundIDs,Module.GoreSoundPitchMin,Module.GoreSoundPitchMax,Module.GoreSoundVolume,VisualEffects.GoreEffect,Module.FullyGibbedLimbChance}})
  892. end
  893.  
  894. local function Overheat()
  895. if Variables.ActuallyEquipped and Variables.Enabled and not Variables.Overheated and (Variables.Ammo > 0 or not Module.LimitedAmmoEnabled) and Variables.Heat >= Module.MaxHeat then
  896. Variables.Overheated = true
  897. if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
  898. Animations.InspectAnim:Stop()
  899. end
  900. if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
  901. VMAnimations.VMInspectAnim:Stop()
  902. end
  903. if Variables.AimDown then
  904. TweenService:Create(Camera, TweenInfo.new(Module.TweenLengthNAD, Module.EasingStyleNAD, Module.EasingDirectionNAD), {FieldOfView = 70}):Play()
  905. SetCrossScale(1)
  906. if Module.AimAnimationsEnabled and Animations.AimIdleAnim and Animations.AimIdleAnim.IsPlaying then
  907. Animations.AimIdleAnim:Stop()
  908. if Animations.IdleAnim then
  909. Animations.IdleAnim:Play(nil, nil, Module.IdleAnimationSpeed)
  910. end
  911. end
  912. if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
  913. Viewmodel.isAiming.Value = false
  914. end
  915. Variables.Scoping = false
  916. Player.CameraMode = Enum.CameraMode.Classic
  917. UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity
  918. Variables.AimDown = false
  919. end
  920. UpdateGUI()
  921. if Variables.ActuallyEquipped then
  922. if Animations.OverheatAnim then
  923. Animations.OverheatAnim:Play(nil, nil, Module.OverheatAnimationSpeed)
  924. end
  925. if VMAnimations.VMOverheatAnim then
  926. VMAnimations.VMOverheatAnim:Play(nil, nil, Module.VMOverheatAnimationSpeed)
  927. end
  928. Handle.OverheatSound:Play()
  929. end
  930. --Thread:Wait(Module.OverheatTime)
  931. for i = 1, Module.MaxHeat do
  932. Thread:Wait(Module.OverheatTime / Module.MaxHeat)
  933. Variables.Heat = Variables.Heat - 1
  934. UpdateGUI()
  935. if Variables.Heat == 0 then
  936. Variables.Overheated = false
  937. break
  938. end
  939. end
  940. Variables.Overheated = false
  941. UpdateGUI()
  942. end
  943. end
  944.  
  945. local function Reload()
  946. if Variables.ActuallyEquipped and Variables.Enabled and not Variables.Reloading and (Variables.Ammo > 0 or not Module.LimitedAmmoEnabled) and Variables.Mag < Module.AmmoPerMag then
  947. Variables.Reloading = true
  948. if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
  949. Animations.InspectAnim:Stop()
  950. end
  951. if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
  952. VMAnimations.VMInspectAnim:Stop()
  953. end
  954. if Variables.AimDown then
  955. TweenService:Create(Camera, TweenInfo.new(Module.TweenLengthNAD, Module.EasingStyleNAD, Module.EasingDirectionNAD), {FieldOfView = 70}):Play()
  956. SetCrossScale(1)
  957. if Module.AimAnimationsEnabled and Animations.AimIdleAnim and Animations.AimIdleAnim.IsPlaying then
  958. Animations.AimIdleAnim:Stop()
  959. if Animations.IdleAnim then
  960. Animations.IdleAnim:Play(nil, nil, Module.IdleAnimationSpeed)
  961. end
  962. end
  963. if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
  964. Viewmodel.isAiming.Value = false
  965. end
  966. Variables.Scoping = false
  967. Player.CameraMode = Enum.CameraMode.Classic
  968. UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity
  969. Variables.AimDown = false
  970. end
  971. UpdateGUI()
  972. if Module.ShotgunReload then
  973. if Module.PreShotgunReload then
  974. if Variables.ActuallyEquipped then
  975. if Animations.PreShotgunReloadAnim then
  976. Animations.PreShotgunReloadAnim:Play(nil, nil, Module.PreShotgunReloadAnimationSpeed)
  977. end
  978. if VMAnimations.VMPreShotgunReloadAnim then
  979. VMAnimations.VMPreShotgunReloadAnim:Play(nil, nil, Module.VMPreShotgunReloadAnimationSpeed)
  980. end
  981. Handle.PreReloadSound:Play()
  982. end
  983. local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.PreShotgunReloadSpeed
  984. --Thread:Wait(Module.PreShotgunReloadSpeed)
  985. end
  986. for i = 1, (Module.AmmoPerMag - Variables.Mag) do
  987. if Variables.ActuallyEquipped then
  988. if Animations.ShotgunClipinAnim then
  989. Animations.ShotgunClipinAnim:Play(nil, nil, Module.ShotgunClipinAnimationSpeed)
  990. end
  991. if VMAnimations.VMShotgunClipinAnim then
  992. VMAnimations.VMShotgunClipinAnim:Play(nil, nil, Module.VMShotgunClipinAnimationSpeed)
  993. end
  994. Handle.ShotgunClipin:Play()
  995. end
  996. local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.ShellClipinSpeed
  997. --Thread:Wait(Module.ShellClipinSpeed)
  998. if Variables.Mag < Module.AmmoPerMag then
  999. if Variables.ActuallyEquipped then
  1000. if Module.LimitedAmmoEnabled then
  1001. if Variables.Ammo > 0 then
  1002. Variables.Mag = Variables.Mag + 1
  1003. Variables.Ammo = Variables.Ammo - 1
  1004. ChangeMagAndAmmo:FireServer(Variables.Mag, Variables.Ammo, Variables.Heat)
  1005. if Module.MagCartridge and not Module.BatteryEnabled then
  1006. for i = 1, Variables.Mag do
  1007. GUI.MagCartridge[i].Visible = true
  1008. end
  1009. end
  1010. UpdateGUI()
  1011. end
  1012. else
  1013. Variables.Mag = Variables.Mag + 1
  1014. Variables.Ammo = Variables.Ammo - 1
  1015. ChangeMagAndAmmo:FireServer(Variables.Mag, Variables.Ammo, Variables.Heat)
  1016. if Module.MagCartridge and not Module.BatteryEnabled then
  1017. for i = 1, Variables.Mag do
  1018. GUI.MagCartridge[i].Visible = true
  1019. end
  1020. end
  1021. UpdateGUI()
  1022. end
  1023. end
  1024. else
  1025. break
  1026. end
  1027. if Module.LimitedAmmoEnabled then
  1028. if (not Variables.ActuallyEquipped) or (Variables.Ammo <= 0) then
  1029. break
  1030. end
  1031. else
  1032. if (not Variables.ActuallyEquipped) then
  1033. break
  1034. end
  1035. end
  1036. end
  1037. end
  1038. if Variables.ActuallyEquipped then
  1039. if Module.TacticalReloadAnimationEnabled then
  1040. if Variables.Mag > 0 then
  1041. if Animations.TacticalReloadAnim then
  1042. Animations.TacticalReloadAnim:Play(nil, nil, Module.TacticalReloadAnimationSpeed)
  1043. end
  1044. if VMAnimations.VMTacticalReloadAnim then
  1045. VMAnimations.VMTacticalReloadAnim:Play(nil, nil, Module.VMTacticalReloadAnimationSpeed)
  1046. end
  1047. Handle.TacticalReloadSound:Play()
  1048. else
  1049. if Animations.ReloadAnim then
  1050. Animations.ReloadAnim:Play(nil, nil, Module.ReloadAnimationSpeed)
  1051. end
  1052. if VMAnimations.VMReloadAnim then
  1053. VMAnimations.VMReloadAnim:Play(nil,nil,Module.VMReloadAnimationSpeed)
  1054. end
  1055. VMAnimations.VMReloadAnim:GetMarkerReachedSignal("MagOut"):Connect(function()
  1056. Handle.MagOut:Play()
  1057. end)
  1058. VMAnimations.VMReloadAnim:GetMarkerReachedSignal("MagIn"):Connect(function()
  1059. Handle.MagIn:Play()
  1060. end)
  1061. VMAnimations.VMReloadAnim:GetMarkerReachedSignal("SlideBack"):Connect(function()
  1062. Handle.SlideBack:Play()
  1063. end)
  1064. end
  1065. else
  1066. if Animations.ReloadAnim then
  1067. Animations.ReloadAnim:Play(nil, nil, Module.ReloadAnimationSpeed)
  1068. end
  1069. if VMAnimations.VMReloadAnim then
  1070. VMAnimations.VMReloadAnim:Play(nil,nil,Module.VMReloadAnimationSpeed)
  1071. end
  1072. VMAnimations.VMReloadAnim:GetMarkerReachedSignal("MagOut"):Connect(function()
  1073. Handle.MagOut:Play()
  1074. end)
  1075. VMAnimations.VMReloadAnim:GetMarkerReachedSignal("MagIn"):Connect(function()
  1076. Handle.MagIn:Play()
  1077. end)
  1078. VMAnimations.VMReloadAnim:GetMarkerReachedSignal("SlideBack"):Connect(function()
  1079. Handle.SlideBack:Play()
  1080. end)
  1081. end
  1082. end
  1083. local ReloadTime = (Variables.Mag > 0 and Module.TacticalReloadAnimationEnabled) and Module.TacticalReloadTime or Module.ReloadTime
  1084. local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= ReloadTime
  1085. --Thread:Wait((Variables.Mag > 0 and Module.TacticalReloadAnimationEnabled) and Module.TacticalReloadTime or Module.ReloadTime)
  1086. if Variables.ActuallyEquipped then
  1087. if not Module.ShotgunReload then
  1088. if Module.MagCartridge and Module.DropAllRemainingBullets and not Module.BatteryEnabled then
  1089. for i = 1, Variables.Mag do
  1090. local Bullet = GUI.MagCartridge:FindFirstChild(i)
  1091. local Vel = Random2DDirection(Module.DropVelocity, math.random(Module.DropXMin, Module.DropXMax), math.random(Module.DropYMin, Module.DropYMax)) * (math.random() ^ 0.5)
  1092. CreateTwoDeeShell(Bullet.Rotation, Bullet.AbsolutePosition, Bullet.AbsoluteSize, Vel, "bullet")
  1093. end
  1094. end
  1095. if Module.LimitedAmmoEnabled then
  1096. local ammoToUse = math.min(Module.AmmoPerMag - Variables.Mag, Variables.Ammo)
  1097. Variables.Mag = Variables.Mag + ammoToUse
  1098. Variables.Ammo = Variables.Ammo - ammoToUse
  1099. else
  1100. Variables.Mag = Module.AmmoPerMag
  1101. end
  1102. ChangeMagAndAmmo:FireServer(Variables.Mag, Variables.Ammo, Variables.Heat)
  1103. end
  1104. end
  1105. Variables.Reloading = false
  1106. if Module.MagCartridge and not Module.BatteryEnabled then
  1107. for i = 1, Variables.Mag do
  1108. GUI.MagCartridge[i].Visible = true
  1109. end
  1110. end
  1111. UpdateGUI()
  1112. end
  1113. end
  1114.  
  1115. local function OnTooglingAiming()
  1116. if not Variables.Reloading and not Variables.Overheated and not Variables.HoldDown and Variables.AimDown == false and Variables.ActuallyEquipped == true and Module.IronsightEnabled and (Camera.Focus.p-Camera.CoordinateFrame.p).Magnitude <= 1 then
  1117. if not Module.KeepAimingOnReloading then
  1118. if Variables.Reloading or Variables.Overheated then
  1119. return
  1120. end
  1121. end
  1122. TweenService:Create(Camera, TweenInfo.new(Module.TweenLength, Module.EasingStyle, Module.EasingDirection), {FieldOfView = Module.FieldOfViewIS}):Play()
  1123. SetCrossScale(Module.CrossScaleIS)
  1124. if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
  1125. Animations.InspectAnim:Stop()
  1126. end
  1127. if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
  1128. VMAnimations.VMInspectAnim:Stop()
  1129. end
  1130. if Module.AimAnimationsEnabled and Animations.IdleAnim and Animations.IdleAnim.IsPlaying then
  1131. Animations.IdleAnim:Stop()
  1132. if Animations.AimIdleAnim then
  1133. Animations.AimIdleAnim:Play(nil, nil, Module.AimIdleAnimationSpeed)
  1134. end
  1135. end
  1136. if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
  1137. Viewmodel.isAiming.Value = true
  1138. end
  1139. Player.CameraMode = Enum.CameraMode.LockFirstPerson
  1140. UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity * Module.MouseSensitiveIS
  1141. Variables.AimDown = true
  1142. elseif not Variables.Reloading and not Variables.Overheated and not Variables.HoldDown and Variables.AimDown == false and Variables.ActuallyEquipped == true and Module.SniperEnabled and (Camera.Focus.p-Camera.CoordinateFrame.p).Magnitude <= 1 then
  1143. if not Module.KeepAimingOnReloading then
  1144. if Variables.Reloading or Variables.Overheated then
  1145. return
  1146. end
  1147. end
  1148. TweenService:Create(Camera, TweenInfo.new(Module.TweenLength, Module.EasingStyle, Module.EasingDirection), {FieldOfView = Module.FieldOfViewS}):Play()
  1149. SetCrossScale(Module.CrossScaleS)
  1150. if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
  1151. Animations.InspectAnim:Stop()
  1152. end
  1153. if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
  1154. VMAnimations.VMInspectAnim:Stop()
  1155. end
  1156. if Module.AimAnimationsEnabled and Animations.IdleAnim and Animations.IdleAnim.IsPlaying then
  1157. Animations.IdleAnim:Stop()
  1158. if Animations.AimIdleAnim then
  1159. Animations.AimIdleAnim:Play(nil, nil, Module.AimIdleAnimationSpeed)
  1160. end
  1161. end
  1162. if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
  1163. Viewmodel.isAiming.Value = true
  1164. end
  1165. Variables.AimDown = true
  1166. local StartTime = os.clock() repeat Thread:Wait() if not (Variables.ActuallyEquipped or Variables.AimDown) then break end until (os.clock() - StartTime) >= Module.ScopeDelay
  1167. if Variables.ActuallyEquipped and Variables.AimDown then
  1168. local ZoomSound = GUI.Scope.ZoomSound:Clone()
  1169. ZoomSound.Parent = Player.PlayerGui
  1170. ZoomSound:Play()
  1171. ZoomSound.Ended:Connect(function()
  1172. ZoomSound:Destroy()
  1173. end)
  1174. Player.CameraMode = Enum.CameraMode.LockFirstPerson
  1175. UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity * Module.MouseSensitiveS
  1176. Variables.Scoping = true
  1177. end
  1178. else
  1179. TweenService:Create(Camera, TweenInfo.new(Module.TweenLengthNAD, Module.EasingStyleNAD, Module.EasingDirectionNAD), {FieldOfView = 70}):Play()
  1180. SetCrossScale(1)
  1181. if Module.AimAnimationsEnabled and Animations.AimIdleAnim and Animations.AimIdleAnim.IsPlaying then
  1182. Animations.AimIdleAnim:Stop()
  1183. if Animations.IdleAnim then
  1184. Animations.IdleAnim:Play(nil, nil, Module.IdleAnimationSpeed)
  1185. end
  1186. end
  1187. if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
  1188. Viewmodel.isAiming.Value = false
  1189. end
  1190. Variables.Scoping = false
  1191. Player.CameraMode = Enum.CameraMode.Classic
  1192. UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity
  1193. Variables.AimDown = false
  1194. end
  1195. end
  1196.  
  1197. local function OnHoldingDown()
  1198. if Module.HoldDownEnabled then
  1199. if not Variables.Reloading and not Variables.Overheated and Variables.ActuallyEquipped and Variables.Enabled then
  1200. if not Variables.HoldDown then
  1201. Variables.HoldDown = true
  1202. if Animations.AimIdleAnim and Animations.AimIdleAnim.IsPlaying then
  1203. Animations.AimIdleAnim:Stop()
  1204. end
  1205. if Animations.IdleAnim and Animations.IdleAnim.IsPlaying then
  1206. Animations.IdleAnim:Stop()
  1207. end
  1208. if VMAnimations.VMIdleAnim and VMAnimations.VMIdleAnim.IsPlaying then
  1209. VMAnimations.VMIdleAnim:Stop()
  1210. end
  1211. if Animations.HoldDownAnim then
  1212. Animations.HoldDownAnim:Play(nil, nil, Module.HoldDownAnimationSpeed)
  1213. end
  1214. if VMAnimations.VMHoldDownAnim then
  1215. VMAnimations.VMHoldDownAnim:Play(nil, nil, Module.VMHoldDownAnimationSpeed)
  1216. end
  1217. if Variables.AimDown then
  1218. TweenService:Create(Camera, TweenInfo.new(Module.TweenLengthNAD, Module.EasingStyleNAD, Module.EasingDirectionNAD), {FieldOfView = 70}):Play()
  1219. SetCrossScale(1)
  1220. if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
  1221. Viewmodel.isAiming.Value = false
  1222. end
  1223. Variables.Scoping = false
  1224. Player.CameraMode = Enum.CameraMode.Classic
  1225. UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity
  1226. Variables.AimDown = false
  1227. end
  1228. else
  1229. Variables.HoldDown = false
  1230. if Animations.IdleAnim then
  1231. Animations.IdleAnim:Play(nil, nil, Module.IdleAnimationSpeed)
  1232. end
  1233. if VMAnimations.VMIdleAnim then
  1234. VMAnimations.VMIdleAnim:Play(nil, nil, Module.VMIdleAnimationSpeed)
  1235. end
  1236. if Animations.HoldDownAnim and Animations.HoldDownAnim.IsPlaying then
  1237. Animations.HoldDownAnim:Stop()
  1238. end
  1239. if VMAnimations.VMHoldDownAnim and VMAnimations.VMHoldDownAnim.IsPlaying then
  1240. VMAnimations.VMHoldDownAnim:Stop()
  1241. end
  1242. end
  1243. end
  1244. end
  1245. end
  1246.  
  1247. local function OnInspecting()
  1248. if not Variables.Reloading and not Variables.Overheated and Variables.ActuallyEquipped and Variables.Enabled and not Variables.AimDown and not Variables.Inspecting and not Variables.Switching and Module.InspectAnimationEnabled then
  1249. Variables.Inspecting = true
  1250. if Animations.InspectAnim then
  1251. Animations.InspectAnim:Play(nil, nil, Module.InspectAnimationSpeed)
  1252. end
  1253. if VMAnimations.VMInspectAnim then
  1254. VMAnimations.VMInspectAnim:Play(nil, nil, Module.VMInspectAnimationSpeed)
  1255. end
  1256. local StartTime = os.clock() --repeat Thread:Wait() if Variables.ActuallyEquipped == false or Variables.Reloading == true or Variables.Overheated == true or Variables.Enabled == false or Variables.AimDown == true or Variables.Switching == true then break end until (os.clock() - StartTime) >= Animations.InspectAnim.Length / Animations.InspectAnim.Speed
  1257. Variables.Inspecting = false
  1258. end
  1259. end
  1260.  
  1261. local function OnSwitching()
  1262. if not Variables.Reloading and not Variables.Overheated and Variables.ActuallyEquipped and Variables.Enabled and not Variables.Inspecting and not Variables.Switching and Module.SelectiveFireEnabled then
  1263. Variables.Switching = true
  1264. if Animations.SwitchAnim then
  1265. Animations.SwitchAnim:Play(nil,nil,Module.SwitchAnimationSpeed)
  1266. end
  1267. if VMAnimations.VMSwitchAnim and not VMAnimations.VMSwitchAnim.IsPlaying then
  1268. VMAnimations.VMSwitchAnim:Play(nil, nil, Module.VMSwitchAnimationSpeed)
  1269. end
  1270. local StartTime = os.clock() repeat Thread:Wait() if Variables.ActuallyEquipped == false or Variables.Reloading == true or Variables.Overheated == true or Variables.Enabled == false or Variables.Inspecting == true then break end until (os.clock() - StartTime) >= Module.SwitchTime
  1271. Variables.Switching = false
  1272. if Variables.ActuallyEquipped and not Variables.Reloading and not Variables.Overheated and Variables.Enabled and not Variables.Inspecting then
  1273. Handle.SwitchSound:Play()
  1274. Variables.FireMode = Variables.FireMode % #Variables.FireModes + 1
  1275. UpdateGUI()
  1276. end
  1277. end
  1278. end
  1279.  
  1280. local function OnFiring()
  1281. if Module.ChargedShotAdvanceEnabled and not Module.SelectiveFireEnabled then
  1282. Variables.Charging = true
  1283. if Variables.ActuallyEquipped and Variables.Enabled and Variables.Charging and not Variables.Reloading and not Variables.Overheated and not Variables.HoldDown and Variables.Mag > 0 and Variables.Heat < Module.MaxHeat and Humanoid.Health > 0 then
  1284. Variables.CanBeCooledDown = false
  1285. Variables.Enabled = false
  1286. if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
  1287. Animations.InspectAnim:Stop()
  1288. end
  1289. if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
  1290. VMAnimations.VMInspectAnim:Stop()
  1291. end
  1292. if Module.AimAnimationsEnabled and Variables.AimDown == true then
  1293. if Animations.AimChargingAnim and not Animations.AimChargingAnim.IsPlaying then
  1294. Animations.AimChargingAnim:Play(nil, nil, Module.AimChargingAnimationSpeed)
  1295. end
  1296. else
  1297. if Animations.ChargingAnim and not Animations.ChargingAnim.IsPlaying then
  1298. Animations.ChargingAnim:Play(nil, nil, Module.ChargingAnimationSpeed)
  1299. end
  1300. end
  1301. if VMAnimations.VMChargingAnim and not VMAnimations.VMChargingAnim.IsPlaying then
  1302. VMAnimations.VMChargingAnim:Play(nil, nil, Module.VMChargingAnimationSpeed)
  1303. end
  1304. local ChargingSound = HandleToFire:FindFirstChild("ChargingSound")
  1305. local StartTime = os.clock()
  1306. while true do
  1307. local DeltaTime = os.clock() - StartTime
  1308. if Variables.ChargeLevel == 0 and DeltaTime >= Module.Level1ChargingTime then
  1309. Variables.ChargeLevel = 1
  1310. GUI.ChargeBar.ChargeLevel1:Play()
  1311. elseif Variables.ChargeLevel == 1 and DeltaTime >= Module.Level2ChargingTime then
  1312. Variables.ChargeLevel = 2
  1313. GUI.ChargeBar.ChargeLevel2:Play()
  1314. elseif Variables.ChargeLevel == 2 and DeltaTime >= Module.AdvancedChargingTime then
  1315. Variables.ChargeLevel = 3
  1316. GUI.ChargeBar.ChargeLevel3:Play()
  1317. GUI.ChargeBar.Shine.UIGradient.Offset = Vector2.new(-1, 0)
  1318. TweenService:Create(GUI.ChargeBar.Shine.UIGradient, TweenInfo.new(0.5, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {Offset = Vector2.new(1, 0)}):Play()
  1319. end
  1320. local ChargePercent = math.min(DeltaTime / Module.AdvancedChargingTime, 1)
  1321. if ChargePercent < 0.5 then --Fade from red to yellow then to green
  1322. GUI.ChargeBar.Fill.BackgroundColor3 = Color3.new(1, ChargePercent * 2, 0)
  1323. else
  1324. GUI.ChargeBar.Fill.BackgroundColor3 = Color3.new(1 - ((ChargePercent - 0.5) / 0.5), 1, 0)
  1325. end
  1326. GUI.ChargeBar.Fill.Size = UDim2.new(ChargePercent, 0, 1, 0)
  1327. if ChargingSound then
  1328. if not ChargingSound.Playing then
  1329. ChargingSound:Play()
  1330. end
  1331. if Module.ChargingSoundIncreasePitch then
  1332. ChargingSound.PlaybackSpeed = Module.ChargingSoundPitchRange[1] + (ChargePercent * (Module.ChargingSoundPitchRange[2] - Module.ChargingSoundPitchRange[1]))
  1333. end
  1334. end
  1335. Thread:Wait()
  1336. if Variables.ActuallyEquipped == false or Variables.Charging == false then
  1337. break
  1338. end
  1339. end
  1340. if Animations.AimChargingAnim and Animations.AimChargingAnim.IsPlaying then
  1341. Animations.AimChargingAnim:Stop(0)
  1342. end
  1343. if Animations.ChargingAnim and Animations.ChargingAnim.IsPlaying then
  1344. Animations.ChargingAnim:Stop(0)
  1345. end
  1346. if VMAnimations.VMChargingAnim and VMAnimations.VMChargingAnim.IsPlaying then
  1347. VMAnimations.VMChargingAnim:Stop(0)
  1348. end
  1349. GUI.ChargeBar.Fill.Size = UDim2.new(0, 0, 1, 0)
  1350. if ChargingSound then
  1351. if ChargingSound.Playing then
  1352. ChargingSound:Stop()
  1353. end
  1354. if Module.ChargingSoundIncreasePitch then
  1355. ChargingSound.PlaybackSpeed = Module.ChargingSoundPitchRange[1]
  1356. end
  1357. end
  1358. if not Variables.ActuallyEquipped then
  1359. Variables.ChargeLevel = 0
  1360. Variables.Enabled = true
  1361. end
  1362. if Variables.ActuallyEquipped and not Variables.Enabled and not Variables.Charging and not Variables.Reloading and not Variables.Overheated and not Variables.HoldDown and Variables.Mag > 0 and Variables.Heat < Module.MaxHeat and Humanoid.Health > 0 then
  1363. for i = 1, (Module.BurstFireEnabled and (AddressTableValue(Module.ChargeAlterTable.BulletPerBurst, Module.BulletPerBurst)) or 1) do
  1364. if not Variables.ActuallyEquipped then
  1365. break
  1366. end
  1367. Variables.ShotID = Variables.ShotID + 1
  1368. local LastShotID = Variables.ShotID
  1369. local CLDirections = {}
  1370. local SVDirections = {}
  1371. --VVV Edit here VVV--
  1372. --Knockback.t = 1 * Vector3.new(-1, -20 * 0.005, 0)
  1373. --^^^ Edit here ^^^--
  1374. Thread:Spawn(RecoilCamera)
  1375. CrossSpring:Accelerate(AddressTableValue(Module.ChargeAlterTable.CrossExpansion, Module.CrossExpansion))
  1376. if not Module.ShotgunPump then
  1377. Thread:Spawn(function()
  1378. local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.BulletShellDelay
  1379. if Variables.ActuallyEquipped then
  1380. EjectShell(((Camera.Focus.p-Camera.CoordinateFrame.p).magnitude <= 1) and VMHandleToFire or HandleToFire)
  1381. end
  1382. end)
  1383. end
  1384. local SoundFolder = HandleToFire.FireSounds
  1385. if Variables.ChargeLevel == 1 then
  1386. if HandleToFire:FindFirstChild("FireSoundsLvl1") then
  1387. SoundFolder = HandleToFire.FireSoundsLvl1
  1388. else
  1389. SoundFolder = HandleToFire.FireSounds
  1390. end
  1391. elseif Variables.ChargeLevel == 2 then
  1392. if HandleToFire:FindFirstChild("FireSoundsLvl2") then
  1393. SoundFolder = HandleToFire.FireSoundsLvl2
  1394. else
  1395. SoundFolder = HandleToFire.FireSounds
  1396. end
  1397. elseif Variables.ChargeLevel == 3 then
  1398. if HandleToFire:FindFirstChild("FireSoundsLvl3") then
  1399. SoundFolder = HandleToFire.FireSoundsLvl3
  1400. else
  1401. SoundFolder = HandleToFire.FireSounds
  1402. end
  1403. end
  1404. local Tracks = SoundFolder:GetChildren()
  1405. local Chosen = math.random(1, #Tracks)
  1406. local Track = Tracks[Chosen]
  1407. if Track ~= nil then
  1408. AudioHandler:PlayAudio({
  1409. SoundId = Track.SoundId,
  1410. EmitterSize = Track.EmitterSize,
  1411. MaxDistance = Track.MaxDistance,
  1412. Volume = Track.Volume,
  1413. Pitch = Track.PlaybackSpeed,
  1414. Origin = HandleToFire:FindFirstChild("GunMuzzlePoint"),
  1415. Echo = Module.EchoEffect,
  1416. Silenced = Module.SilenceEffect
  1417. },
  1418. {
  1419. Enabled = Module.LowAmmo,
  1420. CurrentAmmo = Variables.Mag,
  1421. AmmoPerMag = Module.AmmoPerMag,
  1422. SoundId = HandleToFire.LowAmmoSound.SoundId,
  1423. EmitterSize = HandleToFire.LowAmmoSound.EmitterSize,
  1424. MaxDistance = HandleToFire.LowAmmoSound.MaxDistance,
  1425. Volume = HandleToFire.LowAmmoSound.Volume,
  1426. Pitch = Module.RaisePitch and (math.max(math.abs(Variables.Mag / 10 - 1), 0.4)) or HandleToFire.LowAmmoSound.PlaybackSpeed,
  1427. Origin = HandleToFire:FindFirstChild("GunMuzzlePoint")
  1428. }, true)
  1429. end
  1430. local MuzzleFolder = VisualEffects.MuzzleEffect
  1431. if Variables.ChargeLevel == 1 then
  1432. if VisualEffects:FindFirstChild("MuzzleEffectLvl1") then
  1433. MuzzleFolder = VisualEffects.MuzzleEffectLvl1
  1434. else
  1435. MuzzleFolder = VisualEffects.MuzzleEffect
  1436. end
  1437. elseif Variables.ChargeLevel == 2 then
  1438. if VisualEffects:FindFirstChild("MuzzleEffectLvl2") then
  1439. MuzzleFolder = VisualEffects.MuzzleEffectLvl2
  1440. else
  1441. MuzzleFolder = VisualEffects.MuzzleEffect
  1442. end
  1443. elseif Variables.ChargeLevel == 3 then
  1444. if VisualEffects:FindFirstChild("MuzzleEffectLvl3") then
  1445. MuzzleFolder = VisualEffects.MuzzleEffectLvl3
  1446. else
  1447. MuzzleFolder = VisualEffects.MuzzleEffect
  1448. end
  1449. end
  1450. MuzzleHandler:VisualizeMuzzle(HandleToFire,
  1451. (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 and VMHandleToFire or nil,
  1452. Module.MuzzleFlashEnabled,
  1453. {Module.MuzzleLightEnabled,AddressTableValue(Module.ChargeAlterTable.LightBrightness, Module.LightBrightness),AddressTableValue(Module.ChargeAlterTable.LightColor, Module.LightColor),AddressTableValue(Module.ChargeAlterTable.LightRange, Module.LightRange),Module.LightShadows,Module.VisibleTime},
  1454. MuzzleFolder,
  1455. true)
  1456. Variables.CurrentRate = Variables.CurrentRate + Module.SmokeTrailRateIncrement
  1457. for ii = 1, (Module.ShotgunEnabled and (AddressTableValue(Module.ChargeAlterTable.BulletPerShot, Module.BulletPerShot)) or 1) do
  1458. local Position = Get3DPosition(GUI.Crosshair.AbsolutePosition)
  1459. local Spread = AddressTableValue(Module.ChargeAlterTable.Spread, Module.Spread)
  1460. local CurrentSpread = Spread * 10 * (Variables.AimDown and 1 - Module.SpreadRedutionIS and 1 - Module.SpreadRedutionS or 1)
  1461. local cframe = (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 and CFrame.new(VMHandleToFire:FindFirstChild("GunFirePoint").WorldPosition, Position) or CFrame.new(HandleToFire:FindFirstChild("GunFirePoint").WorldPosition, Position)
  1462. local svCframe = CFrame.new(HandleToFire:FindFirstChild("GunFirePoint").WorldPosition, Position)
  1463.  
  1464. local X, Y = Module.SpreadPattern[ii][1], Module.SpreadPattern[ii][2]
  1465. local SpreadPattern = CFrame.Angles(math.rad(CurrentSpread * Y / 50), math.rad(CurrentSpread * X / 50), 0)
  1466. local SpreadNormal = CFrame.Angles(math.rad(math.random(-CurrentSpread, CurrentSpread) / 50), math.rad(math.random(-CurrentSpread, CurrentSpread) / 50), 0)
  1467.  
  1468. if Module.ShotgunPattern and Module.SpreadPattern then
  1469. cframe = cframe * SpreadPattern
  1470. svCframe = svCframe * SpreadPattern
  1471. else
  1472. cframe = cframe * SpreadNormal
  1473. svCframe = svCframe * SpreadNormal
  1474. end
  1475.  
  1476. local ClDirection = cframe.LookVector
  1477. local SvDirection = svCframe.LookVector
  1478. table.insert(CLDirections, ClDirection)
  1479. table.insert(SVDirections, SvDirection)
  1480. end
  1481. if AddressTableValue(Module.ChargeAlterTable.SelfKnockback, Module.SelfKnockback) then
  1482. local KnockbackPosition = Get3DPosition(GUI.Crosshair.AbsolutePosition)
  1483. SelfKnockback(KnockbackPosition, Torso.Position)
  1484. end
  1485. Fire(HandleToFire, VMHandleToFire, CLDirections, SVDirections)
  1486. if Module.BatteryEnabled then
  1487. Variables.ShotsForDepletion = Variables.ShotsForDepletion + 1
  1488. if Variables.ShotsForDepletion >= Module.ShotsForDepletion then
  1489. Variables.ShotsForDepletion = 0
  1490. Variables.Ammo = Variables.Ammo - Random.new():NextInteger(AddressTableValue(Module.ChargeAlterTable.MinDepletion, Module.MinDepletion), AddressTableValue(Module.ChargeAlterTable.MaxDepletion, Module.MaxDepletion))
  1491. end
  1492. Variables.Heat = Variables.Heat + Random.new():NextInteger(AddressTableValue(Module.ChargeAlterTable.HeatPerFireMin, Module.HeatPerFireMin), AddressTableValue(Module.ChargeAlterTable.HeatPerFireMax, Module.HeatPerFireMax))
  1493. else
  1494. if Module.MagCartridge and not Module.BatteryEnabled and Module.AmmoPerMag ~= math.huge then
  1495. local Bullet = GUI.MagCartridge:FindFirstChild(Variables.Mag)
  1496. if Module.Ejection then
  1497. local Vel = Random2DDirection(Module.Velocity, math.random(Module.XMin, Module.XMax), math.random(Module.YMin, Module.YMax)) * (math.random() ^ 0.5)
  1498. CreateTwoDeeShell(Bullet.Rotation, Bullet.AbsolutePosition, Bullet.AbsoluteSize, Vel, "shell", Module.Shockwave)
  1499. end
  1500. Bullet.Visible = false
  1501. end
  1502. Variables.Mag = Variables.Mag - 1
  1503. end
  1504. ChangeMagAndAmmo:FireServer(Variables.Mag, Variables.Ammo, Variables.Heat)
  1505. Thread:Spawn(function()
  1506. local Interrupted = false
  1507. local StartTime = os.clock() repeat Thread:Wait() if LastShotID ~= Variables.ShotID then break end until (os.clock() - StartTime) >= Module.TimeBeforeCooldown
  1508. if LastShotID ~= Variables.ShotID then Interrupted = true end
  1509. if not Interrupted then
  1510. Variables.CanBeCooledDown = true
  1511. end
  1512. end)
  1513. UpdateGUI()
  1514. if Module.BurstFireEnabled then
  1515. local BurstRate = AddressTableValue(Module.ChargeAlterTable.BurstRate, Module.BurstRate)
  1516. local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= BurstRate
  1517. --Thread:Wait(Module.BurstRate)
  1518. end
  1519. --[[if not Variables.ActuallyEquipped then
  1520. break
  1521. end]]
  1522. if Module.BatteryEnabled then
  1523. if Variables.Heat >= Module.MaxHeat then
  1524. break
  1525. end
  1526. else
  1527. if Variables.Mag <= 0 then
  1528. break
  1529. end
  1530. end
  1531. end
  1532. if not Module.ShotgunPump then
  1533. HandleToFire = (HandleToFire == Handle and Module.DualEnabled) and Handle2 or Handle
  1534. VMHandleCounts = (VMHandleCounts == 1 and Module.DualEnabled) and 2 or 1
  1535. VMHandleToFire = VMHandleCounts == 1 and VMHandle or VMHandle2
  1536.  
  1537. if Module.AimAnimationsEnabled then
  1538. CurrentAimFireAnim = (CurrentAimFireAnim == Animations.AimFireAnim and Module.SecondaryFireAnimationEnabled) and Animations.AimSecondaryFireAnim or Animations.AimFireAnim
  1539. CurrentAimFireAnimationSpeed = (CurrentAimFireAnimationSpeed == Module.AimFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.AimSecondaryFireAnimationSpeed or Module.AimFireAnimationSpeed
  1540. end
  1541.  
  1542. CurrentFireAnim = (CurrentFireAnim == Animations.FireAnim and Module.SecondaryFireAnimationEnabled) and Animations.SecondaryFireAnim or Animations.FireAnim
  1543. CurrentFireAnimationSpeed = (CurrentFireAnimationSpeed == Module.FireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.SecondaryFireAnimationSpeed or Module.FireAnimationSpeed
  1544.  
  1545. CurrentVMFireAnim = (CurrentVMFireAnim == VMAnimations.VMFireAnim and Module.SecondaryFireAnimationEnabled) and VMAnimations.VMSecondaryFireAnim or VMAnimations.VMFireAnim
  1546. CurrentVMFireAnimationSpeed = (CurrentVMFireAnimationSpeed == Module.VMFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.VMSecondaryFireAnimationSpeed or Module.VMFireAnimationSpeed
  1547. end
  1548. Thread:Wait(AddressTableValue(Module.ChargeAlterTable.FireRate, Module.FireRate))
  1549. if (Module.BatteryEnabled and Variables.Heat >= Module.MaxHeat or Variables.Mag <= 0) then
  1550. if Variables.CurrentRate >= Module.MaximumRate and Module.SmokeTrailEnabled then
  1551. Thread:Spawn(function()
  1552. SmokeTrail:StopEmission()
  1553. SmokeTrail:EmitSmokeTrail(HandleToFire.SmokeTrail, VMHandleToFire.SmokeTrail, Module.MaximumTime)
  1554. end)
  1555. end
  1556. end
  1557. if Module.ShotgunPump then
  1558. if Variables.ActuallyEquipped then
  1559. if CurrentShotgunPumpinAnim then
  1560. CurrentShotgunPumpinAnim:Play(nil, nil, CurrentShotgunPumpinAnimationSpeed)
  1561. end
  1562. if CurrentVMShotgunPumpinAnim then
  1563. CurrentVMShotgunPumpinAnim:Play(nil, nil, CurrentVMShotgunPumpinAnimationSpeed)
  1564. end
  1565. if HandleToFire:FindFirstChild("PumpSound") then
  1566. HandleToFire.PumpSound:Play()
  1567. end
  1568. Thread:Spawn(function()
  1569. local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.BulletShellDelay
  1570. if Variables.ActuallyEquipped then
  1571. EjectShell(((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1) and VMHandleToFire or HandleToFire)
  1572. end
  1573. end)
  1574. end
  1575. HandleToFire = (HandleToFire == Handle and Module.DualEnabled) and Handle2 or Handle
  1576. VMHandleCounts = (VMHandleCounts == 1 and Module.DualEnabled) and 2 or 1
  1577. VMHandleToFire = VMHandleCounts == 1 and VMHandle or VMHandle2
  1578.  
  1579. if Module.AimAnimationsEnabled then
  1580. CurrentAimFireAnim = (CurrentAimFireAnim == Animations.AimFireAnim and Module.SecondaryFireAnimationEnabled) and Animations.AimSecondaryFireAnim or Animations.AimFireAnim
  1581. CurrentAimFireAnimationSpeed = (CurrentAimFireAnimationSpeed == Module.AimFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.AimSecondaryFireAnimationSpeed or Module.AimFireAnimationSpeed
  1582. end
  1583.  
  1584. CurrentFireAnim = (CurrentFireAnim == Animations.FireAnim and Module.SecondaryFireAnimationEnabled) and Animations.SecondaryFireAnim or Animations.FireAnim
  1585. CurrentFireAnimationSpeed = (CurrentFireAnimationSpeed == Module.FireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.SecondaryFireAnimationSpeed or Module.FireAnimationSpeed
  1586.  
  1587. CurrentVMFireAnim = (CurrentVMFireAnim == VMAnimations.MFireAnim and Module.SecondaryFireAnimationEnabled) and VMAnimations.VMSecondaryFireAnim or VMAnimations.VMFireAnim
  1588. CurrentVMFireAnimationSpeed = (CurrentVMFireAnimationSpeed == Module.VMFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.VMSecondaryFireAnimationSpeed or Module.VMFireAnimationSpeed
  1589.  
  1590. CurrentShotgunPumpinAnim = (CurrentShotgunPumpinAnim == Animations.ShotgunPumpinAnim and Module.SecondaryShotgunPump) and Animations.SecondaryShotgunPumpinAnim or Animations.ShotgunPumpinAnim
  1591. CurrentShotgunPumpinAnimationSpeed = (CurrentShotgunPumpinAnimationSpeed == Module.ShotgunPumpinAnimationSpeed and Module.SecondaryShotgunPump) and Module.SecondaryShotgunPumpinAnimationSpeed or Module.ShotgunPumpinAnimationSpeed
  1592.  
  1593. CurrentVMShotgunPumpinAnim = (CurrentVMShotgunPumpinAnim == VMAnimations.VMShotgunPumpinAnim and Module.SecondaryShotgunPump) and VMAnimations.VMSecondaryShotgunPumpinAnim or VMAnimations.VMShotgunPumpinAnim
  1594. CurrentVMShotgunPumpinAnimationSpeed = (CurrentVMShotgunPumpinAnimationSpeed == Module.VMShotgunPumpinAnimationSpeed and Module.SecondaryShotgunPump) and Module.VMSecondaryShotgunPumpinAnimationSpeed or Module.VMShotgunPumpinAnimationSpeed
  1595. Thread:Wait(Module.ShotgunPumpinSpeed)
  1596. end
  1597. Variables.ChargeLevel = 0
  1598. Variables.Enabled = true
  1599. if Variables.ActuallyEquipped then
  1600. if Module.BatteryEnabled then
  1601. if Variables.Heat >= Module.MaxHeat then Overheat() end
  1602. else
  1603. if Module.AutoReload then
  1604. if Variables.Mag <= 0 then Reload() end
  1605. end
  1606. end
  1607. end
  1608. end
  1609. end
  1610. elseif Module.HoldAndReleaseEnabled and not Module.SelectiveFireEnabled then
  1611. Variables.Charging = true
  1612. if Variables.ActuallyEquipped and Variables.Enabled and Variables.Charging and not Variables.Reloading and not Variables.Overheated and not Variables.HoldDown and Variables.Mag > 0 and Variables.Heat < Module.MaxHeat and Humanoid.Health > 0 then
  1613. Variables.CanBeCooledDown = false
  1614. Variables.Enabled = false
  1615. if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
  1616. Animations.InspectAnim:Stop()
  1617. end
  1618. if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
  1619. VMAnimations.VMInspectAnim:Stop()
  1620. end
  1621. if Module.AimAnimationsEnabled and Variables.AimDown == true then
  1622. if Animations.AimChargingAnim and not Animations.AimChargingAnim.IsPlaying then
  1623. Animations.AimChargingAnim:Play(nil, nil, Module.AimChargingAnimationSpeed)
  1624. end
  1625. else
  1626. if Animations.ChargingAnim and not Animations.ChargingAnim.IsPlaying then
  1627. Animations.ChargingAnim:Play(nil, nil, Module.ChargingAnimationSpeed)
  1628. end
  1629. end
  1630. if VMAnimations.VMChargingAnim and not VMAnimations.VMChargingAnim.IsPlaying then
  1631. VMAnimations.VMChargingAnim:Play(nil, nil, Module.VMChargingAnimationSpeed)
  1632. end
  1633. local ChargingSound = HandleToFire:FindFirstChild("ChargingSound")
  1634. local StartTime = os.clock()
  1635. while true do
  1636. local DeltaTime = os.clock() - StartTime
  1637. if not Variables.Charged and DeltaTime >= Module.HoldingTime then
  1638. Variables.Charged = true
  1639. GUI.ChargeBar.ChargeLevel3:Play()
  1640. GUI.ChargeBar.Shine.UIGradient.Offset = Vector2.new(-1, 0)
  1641. TweenService:Create(GUI.ChargeBar.Shine.UIGradient, TweenInfo.new(0.5, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {Offset = Vector2.new(1, 0)}):Play()
  1642. end
  1643. local ChargePercent = math.min(DeltaTime / Module.HoldingTime, 1)
  1644. if ChargePercent < 0.5 then --Fade from red to yellow then to green
  1645. GUI.ChargeBar.Fill.BackgroundColor3 = Color3.new(1, ChargePercent * 2, 0)
  1646. else
  1647. GUI.ChargeBar.Fill.BackgroundColor3 = Color3.new(1 - ((ChargePercent - 0.5) / 0.5), 1, 0)
  1648. end
  1649. GUI.ChargeBar.Fill.Size = UDim2.new(ChargePercent, 0, 1, 0)
  1650. if ChargingSound then
  1651. if not ChargingSound.Playing then
  1652. ChargingSound:Play()
  1653. end
  1654. if Module.ChargingSoundIncreasePitch then
  1655. ChargingSound.PlaybackSpeed = Module.ChargingSoundPitchRange[1] + (ChargePercent * (Module.ChargingSoundPitchRange[2] - Module.ChargingSoundPitchRange[1]))
  1656. end
  1657. end
  1658. Thread:Wait()
  1659. if Variables.ActuallyEquipped == false or Variables.Charging == false then
  1660. break
  1661. end
  1662. end
  1663. if Animations.AimChargingAnim and Animations.AimChargingAnim.IsPlaying then
  1664. Animations.AimChargingAnim:Stop(0)
  1665. end
  1666. if Animations.ChargingAnim and Animations.ChargingAnim.IsPlaying then
  1667. Animations.ChargingAnim:Stop(0)
  1668. end
  1669. if VMAnimations.VMChargingAnim and VMAnimations.VMChargingAnim.IsPlaying then
  1670. VMAnimations.VMChargingAnim:Stop(0)
  1671. end
  1672. GUI.ChargeBar.Fill.Size = UDim2.new(0, 0, 1, 0)
  1673. if ChargingSound then
  1674. if ChargingSound.Playing then
  1675. ChargingSound:Stop()
  1676. end
  1677. if Module.ChargingSoundIncreasePitch then
  1678. ChargingSound.PlaybackSpeed = Module.ChargingSoundPitchRange[1]
  1679. end
  1680. end
  1681. if not Variables.ActuallyEquipped then
  1682. Variables.Charged = false
  1683. Variables.Enabled = true
  1684. end
  1685. if Variables.ActuallyEquipped and not Variables.Enabled and not Variables.Charging and Variables.Charged and not Variables.Reloading and not Variables.Overheated and not Variables.HoldDown and Variables.Mag > 0 and Variables.Heat < Module.MaxHeat and Humanoid.Health > 0 then
  1686. Variables.Charged = false
  1687. for i = 1, (Module.BurstFireEnabled and Module.BulletPerBurst or 1) do
  1688. if not Variables.ActuallyEquipped then
  1689. break
  1690. end
  1691. Variables.ShotID = Variables.ShotID + 1
  1692. local LastShotID = Variables.ShotID
  1693. local CLDirections = {}
  1694. local SVDirections = {}
  1695. --VVV Edit here VVV--
  1696. --Knockback.t = 1 * Vector3.new(-1, -20 * 0.005, 0)
  1697. --^^^ Edit here ^^^--
  1698. Thread:Spawn(RecoilCamera)
  1699. CrossSpring:Accelerate(Module.CrossExpansion)
  1700. if not Module.ShotgunPump then
  1701. Thread:Spawn(function()
  1702. local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.BulletShellDelay
  1703. if Variables.ActuallyEquipped then
  1704. EjectShell(((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1) and VMHandleToFire or HandleToFire)
  1705. end
  1706. end)
  1707. end
  1708. local SoundFolder = HandleToFire.FireSounds
  1709. local Tracks = SoundFolder:GetChildren()
  1710. local Chosen = math.random(1, #Tracks)
  1711. local Track = Tracks[Chosen]
  1712. if Track ~= nil then
  1713. AudioHandler:PlayAudio({
  1714. SoundId = Track.SoundId,
  1715. EmitterSize = Track.EmitterSize,
  1716. MaxDistance = Track.MaxDistance,
  1717. Volume = Track.Volume,
  1718. Pitch = Track.PlaybackSpeed,
  1719. Origin = HandleToFire:FindFirstChild("GunMuzzlePoint"),
  1720. Echo = Module.EchoEffect,
  1721. Silenced = Module.SilenceEffect
  1722. },
  1723. {
  1724. Enabled = Module.LowAmmo,
  1725. CurrentAmmo = Variables.Mag,
  1726. AmmoPerMag = Module.AmmoPerMag,
  1727. SoundId = HandleToFire.LowAmmoSound.SoundId,
  1728. EmitterSize = HandleToFire.LowAmmoSound.EmitterSize,
  1729. MaxDistance = HandleToFire.LowAmmoSound.MaxDistance,
  1730. Volume = HandleToFire.LowAmmoSound.Volume,
  1731. Pitch = Module.RaisePitch and (math.max(math.abs(Variables.Mag / 10 - 1), 0.4)) or HandleToFire.LowAmmoSound.PlaybackSpeed,
  1732. Origin = HandleToFire:FindFirstChild("GunMuzzlePoint")
  1733. }, true)
  1734. end
  1735. local MuzzleFolder = VisualEffects.MuzzleEffect
  1736. MuzzleHandler:VisualizeMuzzle(HandleToFire,
  1737. (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 and VMHandleToFire or nil,
  1738. Module.MuzzleFlashEnabled,
  1739. {Module.MuzzleLightEnabled,Module.LightBrightness,Module.LightColor,Module.LightRange,Module.LightShadows,Module.VisibleTime},
  1740. MuzzleFolder,
  1741. true)
  1742. Variables.CurrentRate = Variables.CurrentRate + Module.SmokeTrailRateIncrement
  1743. for ii = 1, (Module.ShotgunEnabled and Module.BulletPerShot or 1) do
  1744. local Position = Get3DPosition(GUI.Crosshair.AbsolutePosition)
  1745. local CurrentSpread = Module.Spread * 10 * (Variables.AimDown and 1 - Module.SpreadRedutionIS and 1 - Module.SpreadRedutionS or 1)
  1746. local cframe = (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 and CFrame.new(VMHandleToFire:FindFirstChild("GunFirePoint").WorldPosition, Position) or CFrame.new(HandleToFire:FindFirstChild("GunFirePoint").WorldPosition, Position)
  1747. local svCframe = CFrame.new(HandleToFire:FindFirstChild("GunFirePoint").WorldPosition, Position)
  1748.  
  1749. local X, Y = Module.SpreadPattern[ii][1], Module.SpreadPattern[ii][2]
  1750. local SpreadPattern = CFrame.Angles(math.rad(CurrentSpread * Y / 50), math.rad(CurrentSpread * X / 50), 0)
  1751. local SpreadNormal = CFrame.Angles(math.rad(math.random(-CurrentSpread, CurrentSpread) / 50), math.rad(math.random(-CurrentSpread, CurrentSpread) / 50), 0)
  1752.  
  1753. if Module.ShotgunPattern and Module.SpreadPattern then
  1754. cframe = cframe * SpreadPattern
  1755. svCframe = svCframe * SpreadPattern
  1756. else
  1757. cframe = cframe * SpreadNormal
  1758. svCframe = svCframe * SpreadNormal
  1759. end
  1760.  
  1761. local ClDirection = cframe.LookVector
  1762. local SvDirection = svCframe.LookVector
  1763. table.insert(CLDirections, ClDirection)
  1764. table.insert(SVDirections, SvDirection)
  1765. end
  1766. if Module.SelfKnockback then
  1767. local KnockbackPosition = Get3DPosition(GUI.Crosshair.AbsolutePosition)
  1768. SelfKnockback(KnockbackPosition, Torso.Position)
  1769. end
  1770. Fire(HandleToFire, VMHandleToFire, CLDirections, SVDirections)
  1771. if Module.BatteryEnabled then
  1772. Variables.ShotsForDepletion = Variables.ShotsForDepletion + 1
  1773. if Variables.ShotsForDepletion >= Module.ShotsForDepletion then
  1774. Variables.ShotsForDepletion = 0
  1775. Variables.Ammo = Variables.Ammo - Random.new():NextInteger(Module.MinDepletion, Module.MaxDepletion)
  1776. end
  1777. Variables.Heat = Variables.Heat + Random.new():NextInteger(Module.HeatPerFireMin, Module.HeatPerFireMax)
  1778. else
  1779. if Module.MagCartridge and not Module.BatteryEnabled and Module.AmmoPerMag ~= math.huge then
  1780. local Bullet = GUI.MagCartridge:FindFirstChild(Variables.Mag)
  1781. if Module.Ejection then
  1782. local vel = Random2DDirection(Module.Velocity, math.random(Module.XMin, Module.XMax), math.random(Module.YMin, Module.YMax)) * (math.random() ^ 0.5)
  1783. CreateTwoDeeShell(Bullet.Rotation, Bullet.AbsolutePosition, Bullet.AbsoluteSize, vel, "shell", Module.Shockwave)
  1784. end
  1785. Bullet.Visible = false
  1786. end
  1787. Variables.Mag = Variables.Mag - 1
  1788. end
  1789. ChangeMagAndAmmo:FireServer(Variables.Mag, Variables.Ammo, Variables.Heat)
  1790. Thread:Spawn(function()
  1791. local Interrupted = false
  1792. local StartTime = os.clock() repeat Thread:Wait() if LastShotID ~= Variables.ShotID then break end until (os.clock() - StartTime) >= Module.TimeBeforeCooldown
  1793. if LastShotID ~= Variables.ShotID then Interrupted = true end
  1794. if not Interrupted then
  1795. Variables.CanBeCooledDown = true
  1796. end
  1797. end)
  1798. UpdateGUI()
  1799. if Module.BurstFireEnabled then
  1800. local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.BurstRate
  1801. --Thread:Wait(Module.BurstRate)
  1802. end
  1803. --[[if not Variables.ActuallyEquipped then
  1804. break
  1805. end]]
  1806. if Module.BatteryEnabled then
  1807. if Variables.Heat >= Module.MaxHeat then
  1808. break
  1809. end
  1810. else
  1811. if Variables.Mag <= 0 then
  1812. break
  1813. end
  1814. end
  1815. end
  1816. if not Module.ShotgunPump then
  1817. HandleToFire = (HandleToFire == Handle and Module.DualEnabled) and Handle2 or Handle
  1818. VMHandleCounts = (VMHandleCounts == 1 and Module.DualEnabled) and 2 or 1
  1819. VMHandleToFire = VMHandleCounts == 1 and VMHandle or VMHandle2
  1820.  
  1821. if Module.AimAnimationsEnabled then
  1822. CurrentAimFireAnim = (CurrentAimFireAnim == Animations.AimFireAnim and Module.SecondaryFireAnimationEnabled) and Animations.AimSecondaryFireAnim or Animations.AimFireAnim
  1823. CurrentAimFireAnimationSpeed = (CurrentAimFireAnimationSpeed == Module.AimFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.AimSecondaryFireAnimationSpeed or Module.AimFireAnimationSpeed
  1824. end
  1825.  
  1826. CurrentFireAnim = (CurrentFireAnim == Animations.FireAnim and Module.SecondaryFireAnimationEnabled) and Animations.SecondaryFireAnim or Animations.FireAnim
  1827. CurrentFireAnimationSpeed = (CurrentFireAnimationSpeed == Module.FireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.SecondaryFireAnimationSpeed or Module.FireAnimationSpeed
  1828.  
  1829. CurrentVMFireAnim = (CurrentVMFireAnim == VMAnimations.VMFireAnim and Module.SecondaryFireAnimationEnabled) and VMAnimations.VMSecondaryFireAnim or VMAnimations.VMFireAnim
  1830. CurrentVMFireAnimationSpeed = (CurrentVMFireAnimationSpeed == Module.VMFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.VMSecondaryFireAnimationSpeed or Module.VMFireAnimationSpeed
  1831. end
  1832. Thread:Wait(Module.FireRate)
  1833. if (Module.BatteryEnabled and Variables.Heat >= Module.MaxHeat or Variables.Mag <= 0) then
  1834. if Variables.CurrentRate >= Module.MaximumRate and Module.SmokeTrailEnabled then
  1835. Thread:Spawn(function()
  1836. SmokeTrail:StopEmission()
  1837. SmokeTrail:EmitSmokeTrail(HandleToFire.SmokeTrail, VMHandleToFire.SmokeTrail, Module.MaximumTime)
  1838. end)
  1839. end
  1840. end
  1841. if Module.ShotgunPump then
  1842. if Variables.ActuallyEquipped then
  1843. if CurrentShotgunPumpinAnim then
  1844. CurrentShotgunPumpinAnim:Play(nil, nil, CurrentShotgunPumpinAnimationSpeed)
  1845. end
  1846. if CurrentVMShotgunPumpinAnim then
  1847. CurrentVMShotgunPumpinAnim:Play(nil, nil, CurrentVMShotgunPumpinAnimationSpeed)
  1848. end
  1849. if HandleToFire:FindFirstChild("PumpSound") then
  1850. HandleToFire.PumpSound:Play()
  1851. end
  1852. Thread:Spawn(function()
  1853. local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.BulletShellDelay
  1854. if Variables.ActuallyEquipped then
  1855. EjectShell(((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1) and VMHandleToFire or HandleToFire)
  1856. end
  1857. end)
  1858. end
  1859. HandleToFire = (HandleToFire == Handle and Module.DualEnabled) and Handle2 or Handle
  1860. VMHandleCounts = (VMHandleCounts == 1 and Module.DualEnabled) and 2 or 1
  1861. VMHandleToFire = VMHandleCounts == 1 and VMHandle or VMHandle2
  1862.  
  1863. if Module.AimAnimationsEnabled then
  1864. CurrentAimFireAnim = (CurrentAimFireAnim == Animations.AimFireAnim and Module.SecondaryFireAnimationEnabled) and Animations.AimSecondaryFireAnim or Animations.AimFireAnim
  1865. CurrentAimFireAnimationSpeed = (CurrentAimFireAnimationSpeed == Module.AimFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.AimSecondaryFireAnimationSpeed or Module.AimFireAnimationSpeed
  1866. end
  1867.  
  1868. CurrentFireAnim = (CurrentFireAnim == Animations.FireAnim and Module.SecondaryFireAnimationEnabled) and Animations.SecondaryFireAnim or Animations.FireAnim
  1869. CurrentFireAnimationSpeed = (CurrentFireAnimationSpeed == Module.FireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.SecondaryFireAnimationSpeed or Module.FireAnimationSpeed
  1870.  
  1871. CurrentVMFireAnim = (CurrentVMFireAnim == VMAnimations.VMFireAnim and Module.SecondaryFireAnimationEnabled) and VMAnimations.VMSecondaryFireAnim or VMAnimations.VMFireAnim
  1872. CurrentVMFireAnimationSpeed = (CurrentVMFireAnimationSpeed == Module.VMFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.VMSecondaryFireAnimationSpeed or Module.VMFireAnimationSpeed
  1873.  
  1874. CurrentShotgunPumpinAnim = (CurrentShotgunPumpinAnim == Animations.ShotgunPumpinAnim and Module.SecondaryShotgunPump) and Animations.SecondaryShotgunPumpinAnim or Animations.ShotgunPumpinAnim
  1875. CurrentShotgunPumpinAnimationSpeed = (CurrentShotgunPumpinAnimationSpeed == Module.ShotgunPumpinAnimationSpeed and Module.SecondaryShotgunPump) and Module.SecondaryShotgunPumpinAnimationSpeed or Module.ShotgunPumpinAnimationSpeed
  1876.  
  1877. CurrentVMShotgunPumpinAnim = (CurrentVMShotgunPumpinAnim == VMAnimations.VMShotgunPumpinAnim and Module.SecondaryShotgunPump) and VMAnimations.VMSecondaryShotgunPumpinAnim or VMAnimations.VMShotgunPumpinAnim
  1878. CurrentVMShotgunPumpinAnimationSpeed = (CurrentVMShotgunPumpinAnimationSpeed == Module.VMShotgunPumpinAnimationSpeed and Module.SecondaryShotgunPump) and Module.VMSecondaryShotgunPumpinAnimationSpeed or Module.VMShotgunPumpinAnimationSpeed
  1879. Thread:Wait(Module.ShotgunPumpinSpeed)
  1880. end
  1881. Variables.Enabled = true
  1882. if Variables.ActuallyEquipped then
  1883. if Module.BatteryEnabled then
  1884. if Variables.Heat >= Module.MaxHeat then
  1885. Overheat()
  1886. end
  1887. else
  1888. if Module.AutoReload then
  1889. if Variables.Mag <= 0 then
  1890. Reload()
  1891. end
  1892. end
  1893. end
  1894. end
  1895. end
  1896. end
  1897. else
  1898. Variables.Down = true
  1899. local IsChargedShot = false
  1900. if Variables.ActuallyEquipped and Variables.Enabled and Variables.Down and not Variables.Reloading and not Variables.Overheated and not Variables.HoldDown and Variables.Mag > 0 and Variables.Heat < Module.MaxHeat and Humanoid.Health > 0 then
  1901. Variables.CanBeCooledDown = false
  1902. Variables.Enabled = false
  1903. if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
  1904. Animations.InspectAnim:Stop()
  1905. end
  1906. if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
  1907. VMAnimations.VMInspectAnim:Stop()
  1908. end
  1909. if Module.ChargedShotEnabled then
  1910. if Variables.ActuallyEquipped and HandleToFire:FindFirstChild("ChargeSound") then
  1911. HandleToFire.ChargeSound:Play()
  1912. end
  1913. Thread:Wait(Module.ChargingTime)
  1914. IsChargedShot = true
  1915. end
  1916. if Module.MinigunEnabled then
  1917. if Animations.MinigunRevUpAnim and not Animations.MinigunRevUpAnim.IsPlaying then
  1918. Animations.MinigunRevUpAnim:Play(nil, nil, Module.MinigunRevUpAnimationSpeed)
  1919. end
  1920. if VMAnimations.VMMinigunRevUpAnim and not VMAnimations.VMMinigunRevUpAnim.IsPlaying then
  1921. VMAnimations.VMMinigunRevUpAnim:Play(nil, nil, Module.VMMinigunRevUpAnimationSpeed)
  1922. end
  1923. if Variables.ActuallyEquipped and HandleToFire:FindFirstChild("WindUp") then
  1924. HandleToFire.WindUp:Play()
  1925. end
  1926. Thread:Wait(Module.DelayBeforeFiring)
  1927. end
  1928. while Variables.ActuallyEquipped and not Variables.Reloading and not Variables.Overheated and not Variables.HoldDown and (Variables.Down or IsChargedShot) and Variables.Mag > 0 and Variables.Heat < Module.MaxHeat and Humanoid.Health > 0 do
  1929. IsChargedShot = false
  1930. for i = 1, ((Module.SelectiveFireEnabled and (Variables.FireModes[Variables.FireMode] ~= true and Variables.FireModes[Variables.FireMode] or 1)) or (Module.BurstFireEnabled and Module.BulletPerBurst) or 1) do
  1931. if not Variables.ActuallyEquipped then
  1932. break
  1933. end
  1934. Variables.ShotID = Variables.ShotID + 1
  1935. local LastShotID = Variables.ShotID
  1936. local Directions = {}
  1937. local CLDirections = {}
  1938. local SVDirections = {}
  1939. --VVV Edit here VVV--
  1940. --Knockback.t = 1 * Vector3.new(-1, -20 * 0.005, 0)
  1941. --^^^ Edit here ^^^--
  1942. Thread:Spawn(RecoilCamera)
  1943. CrossSpring:Accelerate(Module.CrossExpansion)
  1944. if not Module.ShotgunPump then
  1945. Thread:Spawn(function()
  1946. local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.BulletShellDelay
  1947. if Variables.ActuallyEquipped then
  1948. EjectShell(((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1) and VMHandleToFire or HandleToFire)
  1949. end
  1950. end)
  1951. end
  1952. local Tracks = HandleToFire.FireSounds:GetChildren()
  1953. local Chosen = math.random(1, #Tracks)
  1954. local Track = Tracks[Chosen]
  1955. if Track ~= nil then
  1956. AudioHandler:PlayAudio({
  1957. SoundId = Track.SoundId,
  1958. EmitterSize = Track.EmitterSize,
  1959. MaxDistance = Track.MaxDistance,
  1960. Volume = Track.Volume,
  1961. Pitch = Track.PlaybackSpeed,
  1962. Origin = HandleToFire:FindFirstChild("GunMuzzlePoint"),
  1963. Echo = Module.EchoEffect,
  1964. Silenced = Module.SilenceEffect
  1965. },
  1966. {
  1967. Enabled = Module.LowAmmo,
  1968. CurrentAmmo = Variables.Mag,
  1969. AmmoPerMag = Module.AmmoPerMag,
  1970. SoundId = HandleToFire.LowAmmoSound.SoundId,
  1971. EmitterSize = HandleToFire.LowAmmoSound.EmitterSize,
  1972. MaxDistance = HandleToFire.LowAmmoSound.MaxDistance,
  1973. Volume = HandleToFire.LowAmmoSound.Volume,
  1974. Pitch = Module.RaisePitch and (math.max(math.abs(Variables.Mag / 10 - 1), 0.4)) or HandleToFire.LowAmmoSound.PlaybackSpeed,
  1975. Origin = HandleToFire:FindFirstChild("GunMuzzlePoint")
  1976. }, true)
  1977. end
  1978. local MuzzleFolder = VisualEffects.MuzzleEffect
  1979. MuzzleHandler:VisualizeMuzzle(HandleToFire,
  1980. (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 and VMHandleToFire or nil,
  1981. Module.MuzzleFlashEnabled,
  1982. {Module.MuzzleLightEnabled,Module.LightBrightness,Module.LightColor,Module.LightRange,Module.LightShadows,Module.VisibleTime},
  1983. MuzzleFolder,
  1984. true)
  1985. Variables.CurrentRate = Variables.CurrentRate + Module.SmokeTrailRateIncrement
  1986. for ii = 1, (Module.ShotgunEnabled and Module.BulletPerShot or 1) do
  1987. local Position = Get3DPosition(GUI.Crosshair.AbsolutePosition)
  1988. local Spread = Module.Spread * 10 * (Variables.AimDown and 1 - Module.SpreadRedutionIS and 1 - Module.SpreadRedutionS or 1)
  1989. local cframe = (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 and CFrame.new(VMHandleToFire:FindFirstChild("GunFirePoint").WorldPosition, Position) or CFrame.new(HandleToFire:FindFirstChild("GunFirePoint").WorldPosition, Position)
  1990. local svCframe = CFrame.new(HandleToFire:FindFirstChild("GunFirePoint").WorldPosition, Position)
  1991.  
  1992. local X, Y = Module.SpreadPattern[ii][1], Module.SpreadPattern[ii][2]
  1993. local SpreadPattern = CFrame.Angles(math.rad(Spread * Y / 50), math.rad(Spread * X / 50), 0)
  1994. local SpreadNormal = CFrame.Angles(math.rad(math.random(-Spread, Spread) / 50), math.rad(math.random(-Spread, Spread) / 50), 0)
  1995.  
  1996. if Module.ShotgunPattern and Module.SpreadPattern then
  1997. cframe = cframe * SpreadPattern
  1998. svCframe = svCframe * SpreadPattern
  1999. else
  2000. cframe = cframe * SpreadNormal
  2001. svCframe = svCframe * SpreadNormal
  2002. end
  2003.  
  2004. local ClDirection = cframe.LookVector
  2005. local SvDirection = svCframe.LookVector
  2006. table.insert(CLDirections, ClDirection)
  2007. table.insert(SVDirections, SvDirection)
  2008. end
  2009. if Module.SelfKnockback then
  2010. local KnockbackPosition = Get3DPosition(GUI.Crosshair.AbsolutePosition)
  2011. SelfKnockback(KnockbackPosition, Torso.Position)
  2012. end
  2013. Fire(HandleToFire, VMHandleToFire, CLDirections, SVDirections)
  2014. if Module.BatteryEnabled then
  2015. Variables.ShotsForDepletion = Variables.ShotsForDepletion + 1
  2016. if Variables.ShotsForDepletion >= Module.ShotsForDepletion then
  2017. Variables.ShotsForDepletion = 0
  2018. Variables.Ammo = Variables.Ammo - Random.new():NextInteger(Module.MinDepletion, Module.MaxDepletion)
  2019. end
  2020. Variables.Heat = Variables.Heat + Random.new():NextInteger(Module.HeatPerFireMin, Module.HeatPerFireMax)
  2021. else
  2022. if Module.MagCartridge and not Module.BatteryEnabled and Module.AmmoPerMag ~= math.huge then
  2023. local Bullet = GUI.MagCartridge:FindFirstChild(Variables.Mag)
  2024. if Module.Ejection then
  2025. local Vel = Random2DDirection(Module.Velocity, math.random(Module.XMin, Module.XMax), math.random(Module.YMin, Module.YMax)) * (math.random() ^ 0.5)
  2026. CreateTwoDeeShell(Bullet.Rotation, Bullet.AbsolutePosition, Bullet.AbsoluteSize, Vel, "shell", Module.Shockwave)
  2027. end
  2028. Bullet.Visible = false
  2029. end
  2030. Variables.Mag = Variables.Mag - 1
  2031. end
  2032. ChangeMagAndAmmo:FireServer(Variables.Mag, Variables.Ammo, Variables.Heat)
  2033. Thread:Spawn(function()
  2034. local Interrupted = false
  2035. local StartTime = os.clock() repeat Thread:Wait() if LastShotID ~= Variables.ShotID then break end until (os.clock() - StartTime) >= Module.TimeBeforeCooldown
  2036. if LastShotID ~= Variables.ShotID then Interrupted = true end
  2037. if not Interrupted then
  2038. Variables.CanBeCooledDown = true
  2039. end
  2040. end)
  2041. UpdateGUI()
  2042. if Module.BurstFireEnabled and not Module.SelectiveFireEnabled then
  2043. local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.BurstRate
  2044. --Thread:Wait(Module.BurstRate)
  2045. end
  2046. if Module.SelectiveFireEnabled then
  2047. local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.BurstRates[Variables.FireMode]
  2048. --Thread:Wait(Module.BurstRates[Variables.FireMode])
  2049. end
  2050. --[[if not Variables.ActuallyEquipped then
  2051. break
  2052. end]]
  2053. if Module.BatteryEnabled then
  2054. if Variables.Heat >= Module.MaxHeat then
  2055. break
  2056. end
  2057. else
  2058. if Variables.Mag <= 0 then
  2059. break
  2060. end
  2061. end
  2062. end
  2063. if not Module.ShotgunPump then
  2064. HandleToFire = (HandleToFire == Handle and Module.DualEnabled) and Handle2 or Handle
  2065. VMHandleCounts = (VMHandleCounts == 1 and Module.DualEnabled) and 2 or 1
  2066. VMHandleToFire = VMHandleCounts == 1 and VMHandle or VMHandle2
  2067.  
  2068. if Module.AimAnimationsEnabled then
  2069. CurrentAimFireAnim = (CurrentAimFireAnim == Animations.AimFireAnim and Module.SecondaryFireAnimationEnabled) and Animations.AimSecondaryFireAnim or Animations.AimFireAnim
  2070. CurrentAimFireAnimationSpeed = (CurrentAimFireAnimationSpeed == Module.AimFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.AimSecondaryFireAnimationSpeed or Module.AimFireAnimationSpeed
  2071. end
  2072.  
  2073. CurrentFireAnim = (CurrentFireAnim == Animations.FireAnim and Module.SecondaryFireAnimationEnabled) and Animations.SecondaryFireAnim or Animations.FireAnim
  2074. CurrentFireAnimationSpeed = (CurrentFireAnimationSpeed == Module.FireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.SecondaryFireAnimationSpeed or Module.FireAnimationSpeed
  2075.  
  2076. CurrentVMFireAnim = (CurrentVMFireAnim == VMAnimations.VMFireAnim and Module.SecondaryFireAnimationEnabled) and VMAnimations.VMSecondaryFireAnim or VMAnimations.VMFireAnim
  2077. CurrentVMFireAnimationSpeed = (CurrentVMFireAnimationSpeed == Module.VMFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.VMSecondaryFireAnimationSpeed or Module.VMFireAnimationSpeed
  2078. end
  2079. Thread:Wait(Module.SelectiveFireEnabled and Module.FireRates[Variables.FireMode] or Module.FireRate)
  2080. if (Module.BatteryEnabled and Variables.Heat >= Module.MaxHeat or Variables.Mag <= 0) then
  2081. if Variables.CurrentRate >= Module.MaximumRate and Module.SmokeTrailEnabled then
  2082. Thread:Spawn(function()
  2083. SmokeTrail:StopEmission()
  2084. SmokeTrail:EmitSmokeTrail(HandleToFire.SmokeTrail, Module.MaximumTime)
  2085. end)
  2086. end
  2087. end
  2088. if Module.SelectiveFireEnabled then
  2089. if Variables.FireModes[Variables.FireMode] ~= true then
  2090. break
  2091. end
  2092. else
  2093. if not Module.Auto then
  2094. break
  2095. end
  2096. end
  2097. end
  2098. --[[if HandleToFire.FireSound.Playing and HandleToFire.FireSound.Looped then
  2099. HandleToFire.FireSound:Stop()
  2100. end]]
  2101. if Module.MinigunEnabled then
  2102. if Variables.ActuallyEquipped and Animations.MinigunRevDownAnim and not Animations.MinigunRevDownAnim.IsPlaying then
  2103. Animations.MinigunRevDownAnim:Play(nil, nil, Module.MinigunRevDownAnimationSpeed)
  2104. end
  2105. if Animations.MinigunRevUpAnim and Animations.MinigunRevUpAnim.IsPlaying then
  2106. Animations.MinigunRevUpAnim:Stop()
  2107. end
  2108. if Variables.ActuallyEquipped and VMAnimations.VMMinigunRevDownAnim and not VMAnimations.VMMinigunRevDownAnim.IsPlaying then
  2109. VMAnimations.VMMinigunRevDownAnim:Play(nil, nil, Module.VMMinigunRevDownAnimationSpeed)
  2110. end
  2111. if VMAnimations.VMMinigunRevUpAnim and VMAnimations.VMMinigunRevUpAnim.IsPlaying then
  2112. VMAnimations.VMMinigunRevUpAnim:Stop()
  2113. end
  2114. if Variables.ActuallyEquipped and HandleToFire:FindFirstChild("WindDown") then
  2115. HandleToFire.WindDown:Play()
  2116. end
  2117. Thread:Wait(Module.DelayAfterFiring)
  2118. end
  2119. if Module.ShotgunPump then
  2120. if Variables.ActuallyEquipped then
  2121. if CurrentShotgunPumpinAnim then
  2122. CurrentShotgunPumpinAnim:Play(nil, nil, CurrentShotgunPumpinAnimationSpeed)
  2123. end
  2124. if CurrentVMShotgunPumpinAnim then
  2125. CurrentVMShotgunPumpinAnim:Play(nil, nil, CurrentVMShotgunPumpinAnimationSpeed)
  2126. end
  2127. if HandleToFire:FindFirstChild("PumpSound") then
  2128. HandleToFire.PumpSound:Play()
  2129. end
  2130. Thread:Spawn(function()
  2131. local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.BulletShellDelay
  2132. if Variables.ActuallyEquipped then
  2133. EjectShell(((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1) and VMHandleToFire or HandleToFire)
  2134. end
  2135. end)
  2136. end
  2137. HandleToFire = (HandleToFire == Handle and Module.DualEnabled) and Handle2 or Handle
  2138. VMHandleCounts = (VMHandleCounts == 1 and Module.DualEnabled) and 2 or 1
  2139. VMHandleToFire = VMHandleCounts == 1 and VMHandle or VMHandle2
  2140.  
  2141. if Module.AimAnimationsEnabled then
  2142. CurrentAimFireAnim = (CurrentAimFireAnim == Animations.AimFireAnim and Module.SecondaryFireAnimationEnabled) and Animations.AimSecondaryFireAnim or Animations.AimFireAnim
  2143. CurrentAimFireAnimationSpeed = (CurrentAimFireAnimationSpeed == Module.AimFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.AimSecondaryFireAnimationSpeed or Module.AimFireAnimationSpeed
  2144. end
  2145.  
  2146. CurrentFireAnim = (CurrentFireAnim == Animations.FireAnim and Module.SecondaryFireAnimationEnabled) and Animations.SecondaryFireAnim or Animations.FireAnim
  2147. CurrentFireAnimationSpeed = (CurrentFireAnimationSpeed == Module.FireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.SecondaryFireAnimationSpeed or Module.FireAnimationSpeed
  2148.  
  2149. CurrentVMFireAnim = (CurrentVMFireAnim == VMAnimations.VMFireAnim and Module.SecondaryFireAnimationEnabled) and VMAnimations.VMSecondaryFireAnim or VMAnimations.VMFireAnim
  2150. CurrentVMFireAnimationSpeed = (CurrentVMFireAnimationSpeed == Module.VMFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.VMSecondaryFireAnimationSpeed or Module.VMFireAnimationSpeed
  2151.  
  2152. CurrentShotgunPumpinAnim = (CurrentShotgunPumpinAnim == Animations.ShotgunPumpinAnim and Module.SecondaryShotgunPump) and Animations.SecondaryShotgunPumpinAnim or Animations.ShotgunPumpinAnim
  2153. CurrentShotgunPumpinAnimationSpeed = (CurrentShotgunPumpinAnimationSpeed == Module.ShotgunPumpinAnimationSpeed and Module.SecondaryShotgunPump) and Module.SecondaryShotgunPumpinAnimationSpeed or Module.ShotgunPumpinAnimationSpeed
  2154.  
  2155. CurrentVMShotgunPumpinAnim = (CurrentVMShotgunPumpinAnim == VMAnimations.VMShotgunPumpinAnim and Module.SecondaryShotgunPump) and VMAnimations.VMSecondaryShotgunPumpinAnim or VMAnimations.VMShotgunPumpinAnim
  2156. CurrentVMShotgunPumpinAnimationSpeed = (CurrentVMShotgunPumpinAnimationSpeed == Module.VMShotgunPumpinAnimationSpeed and Module.SecondaryShotgunPump) and Module.VMSecondaryShotgunPumpinAnimationSpeed or Module.VMShotgunPumpinAnimationSpeed
  2157. Thread:Wait(Module.ShotgunPumpinSpeed)
  2158. end
  2159. Variables.Enabled = true
  2160. if Variables.ActuallyEquipped then
  2161. if Module.BatteryEnabled then
  2162. if Variables.Heat >= Module.MaxHeat then
  2163. Overheat()
  2164. end
  2165. else
  2166. if Module.AutoReload then
  2167. if Variables.Mag <= 0 then
  2168. Reload()
  2169. end
  2170. end
  2171. end
  2172. end
  2173. end
  2174. end
  2175. end
  2176.  
  2177. local function OnStoppingFiring()
  2178. Variables.Down = false
  2179. if Module.ChargedShotAdvanceEnabled or Module.HoldAndReleaseEnabled then
  2180. Variables.Charging = false
  2181. end
  2182. if Module.HoldAndReleaseEnabled and not Variables.Charged then
  2183. Variables.Enabled = true
  2184. end
  2185. if Variables.CurrentRate >= Module.MaximumRate and Module.SmokeTrailEnabled then
  2186. Thread:Spawn(function()
  2187. SmokeTrail:StopEmission()
  2188. SmokeTrail:EmitSmokeTrail(HandleToFire.SmokeTrail, VMHandleToFire.SmokeTrail, Module.MaximumTime)
  2189. end)
  2190. end
  2191. end
  2192.  
  2193. local function OnMeleeSequenceTriggered(ShootingHandle, Range)
  2194. local Direction = ((ShootingHandle.MeleeHitPoint.WorldCFrame * CFrame.new(0, 0, -Range)).p - ShootingHandle.MeleeHitPoint.WorldPosition).Unit
  2195. local MeleeRay = Ray.new(ShootingHandle.MeleeHitPoint.WorldPosition, Direction * Range)
  2196. local Hit, Pos, Norm, Material = Workspace:FindPartOnRayWithIgnoreList(MeleeRay, {Camera, Tool.Parent})
  2197. if Hit then
  2198. if Hit.Name == "_glass" then
  2199. ShatterGlass:FireServer(Hit, Pos, Direction)
  2200. else
  2201. local Target = Hit:FindFirstAncestorOfClass("Model")
  2202. local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
  2203. local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
  2204. if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
  2205. ProjectileHandler:VisualizeHitEffect("Blood", true, Hit, Pos, Norm, Material, true,
  2206. {Module.MeleeBloodEnabled,Module.MeleeHitCharSndIDs,Module.MeleeHitCharSndPitchMin,Module.MeleeHitCharSndPitchMax,Module.MeleeHitCharSndVolume,script.MeleeBloodEffect,{Module.MeleeBloodWoundEnabled, Module.MeleeBloodWoundSize, Module.MeleeBloodWoundTexture, Module.MeleeBloodWoundTextureColor, Module.MeleeBloodWoundVisibleTime, Module.MeleeBloodWoundFadeTime, Module.MeleeBloodWoundPartColor}},
  2207. true)
  2208. if TargetHumanoid.Health > 0 then
  2209. Thread:Spawn(function()
  2210. InflictTargetMelee:InvokeServer(Module,
  2211. TargetHumanoid,
  2212. TargetTorso,
  2213. {Module.MeleeDamage,Module.MeleeHeadshotEnabled,Module.MeleeHeadshotDamageMultiplier},
  2214. {Module.MeleeKnockback,Module.MeleeLifesteal,Module.MeleeAffliction,Module.MeleeAfflictionName,Module.MeleeAfflictChance},
  2215. {Module.MeleeCriticalDamageEnabled,Module.MeleeCriticalBaseChance,Module.MeleeCriticalDamageMultiplier},
  2216. Hit)
  2217. end)
  2218. MarkHit(Hit.Name == "Head" and Module.MeleeHeadshotEnabled)
  2219. end
  2220. else
  2221. ProjectileHandler:VisualizeHitEffect("Normal", true, Hit, Pos, Norm, Material, true,
  2222. {Module.MeleeHitEffectEnabled,Module.MeleeHitSoundIDs,Module.MeleeHitSoundPitchMin,Module.MeleeHitSoundPitchMax,Module.MeleeHitSoundVolume,script.MeleeHitEffect,Module.CustomMeleeHitEffect},
  2223. {Module.MarkerEffectEnabled,Module.MarkerEffectSize,Module.MarkerEffectTexture,Module.MarkerPartColor,Module.MarkerEffectVisibleTime,Module.MarkerEffectFadeTime},
  2224. true)
  2225. end
  2226. end
  2227. end
  2228. end
  2229.  
  2230. local function OnMeleeAttacking()
  2231. if Module.MeleeAttackEnabled then
  2232. if (Animations.MeleeAttackAnim and Animations.MeleeAttackAnim.Length > 0) and (VMAnimations.VMMeleeAttackAnim and VMAnimations.VMMeleeAttackAnim.Length > 0) then
  2233. local Connection
  2234. local VMConnection
  2235. if Variables.ActuallyEquipped and Variables.Enabled and not Variables.Reloading and not Variables.Overheated and not Variables.HoldDown and Humanoid.Health > 0 then
  2236. Variables.Enabled = false
  2237. if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
  2238. Animations.InspectAnim:Stop()
  2239. end
  2240. if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
  2241. VMAnimations.VMInspectAnim:Stop()
  2242. end
  2243. Animations.MeleeAttackAnim:Play(nil, nil, Module.MeleeAttackAnimationSpeed)
  2244. VMAnimations.VMMeleeAttackAnim:Play(nil, nil, Module.VMMeleeAttackAnimationSpeed)
  2245. if Variables.ActuallyEquipped and HandleToFire:FindFirstChild("MeleeSwingSound") then
  2246. HandleToFire.MeleeSwingSound:Play()
  2247. end
  2248. Connection = Animations.MeleeAttackAnim:GetMarkerReachedSignal("MeleeDamageSequence"):Connect(function(ParamString)
  2249. --print(ParamString)
  2250. if ((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude > 1) then
  2251. OnMeleeSequenceTriggered(Handle, Module.MeleeAttackRange)
  2252. end
  2253. if Connection then
  2254. --print("Disconnected")
  2255. Connection:Disconnect()
  2256. Connection = nil
  2257. end
  2258. end)
  2259. VMConnection = VMAnimations.VMMeleeAttackAnim:GetMarkerReachedSignal("MeleeDamageSequence"):Connect(function(ParamString)
  2260. --print(ParamString)
  2261. if ((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1) then
  2262. OnMeleeSequenceTriggered(VMHandle, Module.VMMeleeAttackRange)
  2263. end
  2264. if VMConnection then
  2265. --print("Disconnected")
  2266. VMConnection:Disconnect()
  2267. VMConnection = nil
  2268. end
  2269. end)
  2270. if ((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1) then
  2271. VMAnimations.VMMeleeAttackAnim.Stopped:Wait()
  2272. else
  2273. Animations.MeleeAttackAnim.Stopped:Wait()
  2274. end
  2275. Variables.Enabled = true
  2276. end
  2277. end
  2278. end
  2279. end
  2280.  
  2281. local function OnUnequipping()
  2282. SmokeTrail:StopEmission()
  2283. if Module.ChargedShotAdvanceEnabled then
  2284. Variables.Charging = false
  2285. end
  2286. if Module.HoldAndReleaseEnabled then
  2287. Variables.Charged = false
  2288. end
  2289. Variables.Equipped = false
  2290. Variables.HoldDown = false
  2291. Variables.ActuallyEquipped = false
  2292. if JumpButton then
  2293. AimButton.Parent = GUI.MobileButtons
  2294. FireButton.Parent = GUI.MobileButtons
  2295. HoldDownButton.Parent = GUI.MobileButtons
  2296. InspectButton.Parent = GUI.MobileButtons
  2297. ReloadButton.Parent = GUI.MobileButtons
  2298. SwitchButton.Parent = GUI.MobileButtons
  2299. end
  2300. GUI.Parent = script
  2301. GUI.Frame.Visible = false
  2302. if Module.WalkSpeedRedutionEnabled then
  2303. Humanoid.WalkSpeed = Humanoid.WalkSpeed + Module.WalkSpeedRedution
  2304. else
  2305. Humanoid.WalkSpeed = Humanoid.WalkSpeed
  2306. end
  2307. UserInputService.MouseIconEnabled = false
  2308. RunService:UnbindFromRenderStep(BindToStepName)
  2309. for i, v in pairs(KeyframeConnections) do
  2310. v:Disconnect()
  2311. table.remove(KeyframeConnections, i)
  2312. end
  2313. for i, v in pairs(VMKeyframeConnections) do
  2314. v:Disconnect()
  2315. table.remove(VMKeyframeConnections, i)
  2316. end
  2317. table.clear(VMKeyframes)
  2318. LockedEntity = nil
  2319. TargetMarker.Enabled = false
  2320. TargetMarker.Parent = nil
  2321. TargetMarker.Adornee = nil
  2322. if Beam then
  2323. Beam:Destroy()
  2324. Beam = nil
  2325. end
  2326. if Attach0 then
  2327. Attach0:Destroy()
  2328. Attach0 = nil
  2329. end
  2330. if Attach1 then
  2331. Attach1:Destroy()
  2332. Attach1 = nil
  2333. end
  2334. for _, a in pairs(Animations) do
  2335. if a and a.IsPlaying then
  2336. a:Stop()
  2337. end
  2338. end
  2339. for _, vmA in pairs(VMAnimations) do
  2340. if vmA and vmA.IsPlaying then
  2341. vmA:Stop()
  2342. end
  2343. table.remove(VMAnimations, table.find(VMAnimations, vmA))
  2344. end
  2345. for _, s in pairs(Handle:GetChildren()) do
  2346. if s:IsA("Sound") and s.IsPlaying then
  2347. s:Stop()
  2348. end
  2349. end
  2350. if Handle2 then
  2351. for _, s in pairs(Handle2:GetChildren()) do
  2352. if s:IsA("Sound") and s.IsPlaying then
  2353. s:Stop()
  2354. end
  2355. end
  2356. end
  2357. if Variables.AimDown then
  2358. TweenService:Create(Camera, TweenInfo.new(Module.TweenLengthNAD, Module.EasingStyleNAD, Module.EasingDirectionNAD), {FieldOfView = 70}):Play()
  2359. SetCrossScale(1)
  2360. if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
  2361. Viewmodel.isAiming.Value = false
  2362. end
  2363. Variables.Scoping = false
  2364. Player.CameraMode = Enum.CameraMode.Classic
  2365. UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity
  2366. Variables.AimDown = false
  2367. end
  2368. if Module.DualEnabled and not Workspace.FilteringEnabled then
  2369. Handle2.CanCollide = true
  2370. if Grip2 then
  2371. Grip2:Destroy()
  2372. end
  2373. end
  2374. ViewmodelHandler:CullViewmodel(Viewmodel)
  2375. Viewmodel = nil
  2376. FakeCamera = nil
  2377. end
  2378.  
  2379. --aiming
  2380.  
  2381. AimButton.MouseButton1Click:Connect(function()
  2382. OnTooglingAiming()
  2383. end)
  2384.  
  2385. --holding down gun
  2386.  
  2387. HoldDownButton.MouseButton1Click:Connect(function()
  2388. OnHoldingDown()
  2389. end)
  2390.  
  2391. --inspecting gun
  2392.  
  2393. InspectButton.MouseButton1Click:Connect(function()
  2394. OnInspecting()
  2395. end)
  2396.  
  2397. --switching mode
  2398.  
  2399. SwitchButton.MouseButton1Click:Connect(function()
  2400. OnSwitching()
  2401. end)
  2402.  
  2403. --reloading
  2404.  
  2405. ReloadButton.MouseButton1Click:Connect(function()
  2406. Reload()
  2407. end)
  2408.  
  2409. --firing
  2410.  
  2411. FireButton.MouseButton1Down:Connect(function()
  2412. OnFiring()
  2413. end)
  2414.  
  2415. --non firing
  2416.  
  2417. FireButton.MouseButton1Up:Connect(function()
  2418. OnStoppingFiring()
  2419. end)
  2420.  
  2421. --melee
  2422.  
  2423. MeleeButton.MouseButton1Up:Connect(function()
  2424. OnMeleeAttacking()
  2425. end)
  2426.  
  2427. UserInputService.InputBegan:Connect(function(Input, GameProcessed)
  2428. if GameProcessed then
  2429. return
  2430. end
  2431. if not UserInputService.TouchEnabled then
  2432. if Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.KeyCode == Module.Controller.Fire then
  2433. OnFiring()
  2434. elseif Input.KeyCode == Module.Keyboard.Reload or Input.KeyCode == Module.Controller.Reload then
  2435. Reload()
  2436. elseif Input.KeyCode == Module.Keyboard.HoldDown or Input.KeyCode == Module.Controller.HoldDown then
  2437. OnHoldingDown()
  2438. elseif Input.KeyCode == Module.Keyboard.Inspect or Input.KeyCode == Module.Controller.Inspect then
  2439. OnInspecting()
  2440. elseif Input.KeyCode == Module.Keyboard.Switch or Input.KeyCode == Module.Controller.Switch then
  2441. OnSwitching()
  2442. elseif Input.KeyCode == Module.Keyboard.ToogleAim or Input.KeyCode == Module.Controller.ToogleAim then
  2443. OnTooglingAiming()
  2444. elseif Input.KeyCode == Module.Keyboard.Melee or Input.KeyCode == Module.Controller.Melee then
  2445. OnMeleeAttacking()
  2446. elseif Input.UserInputType == Enum.UserInputType.MouseButton2 then
  2447. if not Variables.Reloading and not Variables.Overheated and not Variables.HoldDown and Variables.AimDown == false and Variables.ActuallyEquipped == true and Module.IronsightEnabled and (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 then
  2448. if not Module.KeepAimingOnReloading then
  2449. if Variables.Reloading or Variables.Overheated then
  2450. return
  2451. end
  2452. end
  2453. TweenService:Create(Camera, TweenInfo.new(Module.TweenLength, Module.EasingStyle, Module.EasingDirection), {FieldOfView = Module.FieldOfViewIS}):Play()
  2454. SetCrossScale(Module.CrossScaleIS)
  2455. if Module.AimAnimationsEnabled and Animations.IdleAnim and Animations.IdleAnim.IsPlaying then
  2456. Animations.IdleAnim:Stop()
  2457. if Animations.AimIdleAnim then
  2458. Animations.AimIdleAnim:Play(nil, nil, Module.AimIdleAnimationSpeed)
  2459. end
  2460. end
  2461. if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
  2462. Viewmodel.isAiming.Value = true
  2463. end
  2464. Player.CameraMode = Enum.CameraMode.LockFirstPerson
  2465. UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity * Module.MouseSensitiveIS
  2466. Variables.AimDown = true
  2467. if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
  2468. Animations.InspectAnim:Stop()
  2469. end
  2470. if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
  2471. VMAnimations.VMInspectAnim:Stop()
  2472. end
  2473. elseif not Variables.Reloading and not Variables.Overheated and not Variables.HoldDown and Variables.AimDown == false and Variables.ActuallyEquipped == true and Module.SniperEnabled and (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 then
  2474. if not Module.KeepAimingOnReloading then
  2475. if Variables.Reloading or Variables.Overheated then
  2476. return
  2477. end
  2478. end
  2479. TweenService:Create(Camera, TweenInfo.new(Module.TweenLength, Module.EasingStyle, Module.EasingDirection), {FieldOfView = Module.FieldOfViewS}):Play()
  2480. SetCrossScale(Module.CrossScaleS)
  2481. if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
  2482. Animations.InspectAnim:Stop()
  2483. end
  2484. if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
  2485. VMAnimations.VMInspectAnim:Stop()
  2486. end
  2487. if Module.AimAnimationsEnabled and Animations.IdleAnim and Animations.IdleAnim.IsPlaying then
  2488. Animations.IdleAnim:Stop()
  2489. if Animations.AimIdleAnim then
  2490. Animations.AimIdleAnim:Play(nil, nil, Module.AimIdleAnimationSpeed)
  2491. end
  2492. end
  2493. if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
  2494. Viewmodel.isAiming.Value = true
  2495. end
  2496. Variables.AimDown = true
  2497. local StartTime = os.clock() repeat Thread:Wait() if not (Variables.ActuallyEquipped or Variables.AimDown) then break end until (os.clock() - StartTime) >= Module.ScopeDelay
  2498. if Variables.ActuallyEquipped and Variables.AimDown then
  2499. local ZoomSound = GUI.Scope.ZoomSound:Clone()
  2500. ZoomSound.Parent = Player.PlayerGui
  2501. ZoomSound:Play()
  2502. ZoomSound.Ended:Connect(function()
  2503. ZoomSound:Destroy()
  2504. end)
  2505. Player.CameraMode = Enum.CameraMode.LockFirstPerson
  2506. UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity * Module.MouseSensitiveS
  2507. Variables.Scoping = true
  2508. end
  2509. end
  2510. end
  2511. end
  2512. end)
  2513.  
  2514. UserInputService.InputEnded:Connect(function(Input, GameProcessed)
  2515. if GameProcessed then
  2516. return
  2517. end
  2518. if not UserInputService.TouchEnabled then
  2519. if Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.KeyCode == Module.Controller.Fire then
  2520. OnStoppingFiring()
  2521. elseif Input.UserInputType == Enum.UserInputType.MouseButton2 then
  2522. if Variables.AimDown then
  2523. TweenService:Create(Camera, TweenInfo.new(Module.TweenLengthNAD, Module.EasingStyleNAD, Module.EasingDirectionNAD), {FieldOfView = 70}):Play()
  2524. SetCrossScale(1)
  2525. if Module.AimAnimationsEnabled and Animations.AimIdleAnim and Animations.AimIdleAnim.IsPlaying then
  2526. Animations.AimIdleAnim:Stop()
  2527. if Animations.IdleAnim then
  2528. Animations.IdleAnim:Play(nil, nil, Module.IdleAnimationSpeed)
  2529. end
  2530. end
  2531. if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
  2532. Viewmodel.isAiming.Value = false
  2533. end
  2534. Variables.Scoping = false
  2535. Player.CameraMode = Enum.CameraMode.Classic
  2536. UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity
  2537. Variables.AimDown = false
  2538. end
  2539. end
  2540. end
  2541. end)
  2542.  
  2543. MarkerEvent.Event:Connect(MarkHit)
  2544.  
  2545. ChangeMagAndAmmo.OnClientEvent:Connect(function(ChangedMag, ChangedAmmo, ChangedHeat)
  2546. Variables.Mag = ChangedMag
  2547. Variables.Ammo = ChangedAmmo
  2548. Variables.Heat = ChangedHeat
  2549. UpdateGUI()
  2550. end)
  2551.  
  2552. Tool.Equipped:Connect(function()
  2553. Variables.Equipped = true
  2554. if JumpButton then
  2555. AimButton.Parent = JumpButton
  2556. FireButton.Parent = JumpButton
  2557. HoldDownButton.Parent = JumpButton
  2558. InspectButton.Parent = JumpButton
  2559. ReloadButton.Parent = JumpButton
  2560. SwitchButton.Parent = JumpButton
  2561. end
  2562. if Module.AmmoPerMag ~= math.huge or Module.MaxHeat ~= math.huge then
  2563. GUI.Frame.Visible = true
  2564. end
  2565. GUI.Parent = Player.PlayerGui
  2566. UpdateGUI()
  2567.  
  2568. --Viewmodel
  2569. Viewmodel = ViewmodelHandler:SetUpViewmodel(Tool.Name)
  2570. FakeCamera = Viewmodel.PrimaryPart:FindFirstChild("FakeCamera") --If "FakeCamera" Motor6D parents outside viewmodel's PrimaryPart (HumanoidRootPart), consider changing the line below.
  2571.  
  2572. VMHandle = Viewmodel:WaitForChild("Handle")
  2573.  
  2574. if Module.DualEnabled then
  2575. VMHandle2 = Viewmodel:WaitForChild("Handle2", 2)
  2576. if VMHandle2 == nil and Module.DualEnabled then error("\"Dual\" setting is enabled but \"VMHandle2\" is missing!") end
  2577. end
  2578.  
  2579. VMHandleCounts = 1
  2580. VMHandleToFire = VMHandleCounts == 1 and VMHandle or VMHandle2
  2581.  
  2582. if Module.VMIdleAnimationID ~= nil then
  2583. VMAnimations.VMIdleAnim = Tool:WaitForChild("VMIdleAnim")
  2584. VMAnimations.VMIdleAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMIdleAnim)
  2585. FindAnimationNameForKeyframe(VMAnimations.VMIdleAnim, true)
  2586. end
  2587. if Module.VMFireAnimationID ~= nil then
  2588. VMAnimations.VMFireAnim = Tool:WaitForChild("VMFireAnim")
  2589. VMAnimations.VMFireAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMFireAnim)
  2590. FindAnimationNameForKeyframe(VMAnimations.VMFireAnim, true)
  2591. end
  2592. if Module.VMReloadAnimationID ~= nil then
  2593. VMAnimations.VMReloadAnim = Tool:WaitForChild("VMReloadAnim")
  2594. VMAnimations.VMReloadAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMReloadAnim)
  2595. FindAnimationNameForKeyframe(VMAnimations.VMReloadAnim, true)
  2596. end
  2597. if Module.VMShotgunClipinAnimationID ~= nil then
  2598. VMAnimations.VMShotgunClipinAnim = Tool:WaitForChild("VMShotgunClipinAnim")
  2599. VMAnimations.VMShotgunClipinAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMShotgunClipinAnim)
  2600. FindAnimationNameForKeyframe(VMAnimations.VMShotgunClipinAnim, true)
  2601. end
  2602. if Module.VMShotgunPumpinAnimationID ~= nil then
  2603. VMAnimations.VMShotgunPumpinAnim = Tool:WaitForChild("VMShotgunPumpinAnim")
  2604. VMAnimations.VMShotgunPumpinAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMShotgunPumpinAnim)
  2605. FindAnimationNameForKeyframe(VMAnimations.VMShotgunPumpinAnim, true)
  2606. end
  2607. if Module.VMSecondaryShotgunPumpinAnimationID ~= nil then
  2608. VMAnimations.VMSecondaryShotgunPumpinAnim = Tool:WaitForChild("VMSecondaryShotgunPumpinAnim")
  2609. VMAnimations.VMSecondaryShotgunPumpinAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMSecondaryShotgunPumpinAnim)
  2610. FindAnimationNameForKeyframe(VMAnimations.VMSecondaryShotgunPumpinAnim, true)
  2611. end
  2612. if Module.VMHoldDownAnimationID ~= nil then
  2613. VMAnimations.VMHoldDownAnim = Tool:WaitForChild("VMHoldDownAnim")
  2614. VMAnimations.VMHoldDownAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMHoldDownAnim)
  2615. FindAnimationNameForKeyframe(VMAnimations.VMHoldDownAnim, true)
  2616. end
  2617. if Module.VMEquippedAnimationID ~= nil then
  2618. VMAnimations.VMEquippedAnim = Tool:WaitForChild("VMEquippedAnim")
  2619. VMAnimations.VMEquippedAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMEquippedAnim)
  2620. FindAnimationNameForKeyframe(VMAnimations.VMEquippedAnim, true)
  2621. end
  2622. if Module.SecondaryFireAnimationEnabled and Module.VMSecondaryFireAnimationID ~= nil then
  2623. VMAnimations.VMSecondaryFireAnim = Tool:WaitForChild("VMSecondaryFireAnim")
  2624. VMAnimations.VMSecondaryFireAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMSecondaryFireAnim)
  2625. FindAnimationNameForKeyframe(VMAnimations.VMSecondaryFireAnim, true)
  2626. end
  2627. if Module.TacticalReloadAnimationEnabled and Module.VMTacticalReloadAnimationID ~= nil then
  2628. VMAnimations.VMTacticalReloadAnim = Tool:WaitForChild("VMTacticalReloadAnim")
  2629. VMAnimations.VMTacticalReloadAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMTacticalReloadAnim)
  2630. FindAnimationNameForKeyframe(VMAnimations.VMTacticalReloadAnim, true)
  2631. end
  2632. if Module.InspectAnimationEnabled and Module.VMInspectAnimationID ~= nil then
  2633. VMAnimations.VMInspectAnim = Tool:WaitForChild("VMInspectAnim")
  2634. VMAnimations.VMInspectAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMInspectAnim)
  2635. FindAnimationNameForKeyframe(VMAnimations.VMInspectAnim, true)
  2636. end
  2637. if Module.ShotgunReload and Module.PreShotgunReload and Module.VMPreShotgunReloadAnimationID ~= nil then
  2638. VMAnimations.VMPreShotgunReloadAnim = Tool:WaitForChild("PreShotgunReloadAnim")
  2639. VMAnimations.VMPreShotgunReloadAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.PreShotgunReloadAnim)
  2640. FindAnimationNameForKeyframe(VMAnimations.VMPreShotgunReloadAnim, true)
  2641. end
  2642. if Module.VMMinigunRevUpAnimationID ~= nil then
  2643. VMAnimations.VMMinigunRevUpAnim = Tool:WaitForChild("VMMinigunRevUpAnim")
  2644. VMAnimations.VMMinigunRevUpAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMMinigunRevUpAnim)
  2645. FindAnimationNameForKeyframe(VMAnimations.VMMinigunRevUpAnim, true)
  2646. end
  2647. if Module.MinigunRevDownAnimationID ~= nil then
  2648. VMAnimations.VMMinigunRevDownAnim = Tool:WaitForChild("VMMinigunRevDownAnim")
  2649. VMAnimations.VMMinigunRevDownAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMMinigunRevDownAnim)
  2650. FindAnimationNameForKeyframe(VMAnimations.VMMinigunRevDownAnim, true)
  2651. end
  2652. if Module.ChargingAnimationEnabled and Module.ChargingAnimationID ~= nil then
  2653. VMAnimations.VMChargingAnim = Tool:WaitForChild("VMChargingAnim")
  2654. VMAnimations.VMChargingAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMChargingAnim)
  2655. FindAnimationNameForKeyframe(VMAnimations.VMChargingAnim, true)
  2656. end
  2657. if Module.SelectiveFireEnabled and Module.VMSwitchAnimationID ~= nil then
  2658. VMAnimations.VMSwitchAnim = Tool:WaitForChild("VMSwitchAnim")
  2659. VMAnimations.VMSwitchAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMSwitchAnim)
  2660. FindAnimationNameForKeyframe(VMAnimations.VMSwitchAnim, true)
  2661. end
  2662. if Module.BatteryEnabled and Module.VMOverheatAnimationID ~= nil then
  2663. VMAnimations.VMOverheatAnim = Tool:WaitForChild("VMOverheatAnim")
  2664. VMAnimations.VMOverheatAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMOverheatAnim)
  2665. FindAnimationNameForKeyframe(VMAnimations.VMOverheatAnim, true)
  2666. end
  2667. if Module.MeleeAttackEnabled and Module.VMMeleeAttackAnimationID ~= nil then
  2668. VMAnimations.VMMeleeAttackAnim = Tool:WaitForChild("VMMeleeAttackAnim")
  2669. VMAnimations.VMMeleeAttackAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMMeleeAttackAnim)
  2670. FindAnimationNameForKeyframe(VMAnimations.VMMeleeAttackAnim, true)
  2671. end
  2672.  
  2673. CurrentVMFireAnim = VMAnimations.VMFireAnim
  2674. CurrentVMFireAnimationSpeed = Module.VMFireAnimationSpeed
  2675. CurrentVMShotgunPumpinAnim = VMAnimations.VMShotgunPumpinAnim
  2676. CurrentVMShotgunPumpinAnimationSpeed = Module.VMShotgunPumpinAnimationSpeed
  2677. --
  2678.  
  2679. Handle.EquippedSound:Play()
  2680. if Module.WalkSpeedRedutionEnabled then
  2681. Humanoid.WalkSpeed = Humanoid.WalkSpeed - Module.WalkSpeedRedution
  2682. else
  2683. Humanoid.WalkSpeed = Humanoid.WalkSpeed
  2684. end
  2685. SetCrossSettings(Module.CrossSize, Module.CrossSpeed, Module.CrossDamper)
  2686. UserInputService.MouseIconEnabled = false
  2687. if Module.ProjectileMotion then
  2688. Beam, Attach0, Attach1 = ProjectileMotion.ShowProjectilePath(script:WaitForChild("MotionBeam"), HandleToFire:FindFirstChild("GunFirePoint").WorldPosition, Vector3.new(), 3, AddressTableValue(Module.ChargeAlterTable.BulletAcceleration, Module.BulletAcceleration))
  2689. end
  2690.  
  2691. RunService:BindToRenderStep(BindToStepName, Enum.RenderPriority.Camera.Value, function(dt)
  2692. --Update crosshair and scope
  2693. RenderMouse()
  2694. RenderScope()
  2695. RenderCrosshair()
  2696. --Update camera
  2697. RenderCam()
  2698. --Update rate
  2699. RenderRate(dt)
  2700. --Render motion
  2701. if Module.ProjectileMotion then
  2702. RenderMotion()
  2703. end
  2704. --Render cooldown
  2705. if Module.BatteryEnabled then
  2706. RenderCooldown(dt)
  2707. end
  2708. --Render 2D shell
  2709. RenderTwoDeeShell(dt)
  2710. end)
  2711.  
  2712. for _, v in pairs(Keyframes) do
  2713. table.insert(KeyframeConnections, v[1]:GetMarkerReachedSignal("AnimationEvents"):Connect(function(keyframeName)
  2714. if v[2][keyframeName] then
  2715. if ((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude > 1) then
  2716. v[2][keyframeName](keyframeName, Tool)
  2717. end
  2718. end
  2719. end))
  2720. end
  2721.  
  2722. for _, v in pairs(VMKeyframes) do
  2723. table.insert(VMKeyframeConnections, v[1]:GetMarkerReachedSignal("AnimationEvents"):Connect(function(keyframeName)
  2724. if v[2][keyframeName] then
  2725. if ((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1) then
  2726. v[2][keyframeName](keyframeName, Tool, Viewmodel)
  2727. end
  2728. end
  2729. end))
  2730. end
  2731.  
  2732. if Animations.EquippedAnim then
  2733. Animations.EquippedAnim:Play(nil, nil, Module.EquippedAnimationSpeed)
  2734. end
  2735. if Animations.IdleAnim then
  2736. Animations.IdleAnim:Play(nil, nil, Module.IdleAnimationSpeed)
  2737. end
  2738.  
  2739. if VMAnimations.VMEquippedAnim then
  2740. VMAnimations.VMEquippedAnim:Play(nil, nil, Module.VMEquippedAnimationSpeed)
  2741. end
  2742. if VMAnimations.VMIdleAnim then
  2743. VMAnimations.VMIdleAnim:Play(nil, nil, Module.VMIdleAnimationSpeed)
  2744. end
  2745.  
  2746. if Module.DualEnabled and not Workspace.FilteringEnabled then
  2747. Handle2.CanCollide = false
  2748. local LeftArm = Tool.Parent:FindFirstChild("Left Arm") or Tool.Parent:FindFirstChild("LeftHand")
  2749. local RightArm = Tool.Parent:FindFirstChild("Right Arm") or Tool.Parent:FindFirstChild("RightHand")
  2750. if RightArm then
  2751. local Grip = RightArm:WaitForChild("RightGrip",0.01)
  2752. if Grip then
  2753. Grip2 = Grip:Clone()
  2754. Grip2.Name = "LeftGrip"
  2755. Grip2.Part0 = LeftArm
  2756. Grip2.Part1 = Handle2
  2757. --Grip2.C1 = Grip2.C1:inverse()
  2758. Grip2.Parent = LeftArm
  2759. end
  2760. end
  2761. end
  2762.  
  2763. local StartTime = os.clock() repeat Thread:Wait() if not Variables.Equipped then break end until (os.clock() - StartTime) >= Module.EquipTime
  2764. if Variables.Equipped then
  2765. Variables.ActuallyEquipped = true
  2766. end
  2767.  
  2768. if Variables.ActuallyEquipped and Module.AutoReload and not Variables.Reloading and (Variables.Ammo > 0 or not Module.LimitedAmmoEnabled) and Variables.Mag <= 0 then
  2769. Reload()
  2770. end
  2771. end)
  2772.  
  2773. Tool.Unequipped:Connect(function()
  2774. OnUnequipping()
  2775. end)
  2776.  
  2777. Humanoid.Died:Connect(function()
  2778. OnUnequipping()
  2779. end)
  2780.  
  2781. Tool.AncestryChanged:Connect(function()
  2782. if not Tool:IsDescendantOf(game) then
  2783. OnUnequipping()
  2784. end
  2785. end)
Advertisement
Add Comment
Please, Sign In to add comment