Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local HttpService = game:GetService("HttpService")
- local GuiService = game:GetService("GuiService")
- local RunService = game:GetService("RunService")
- local UserInputService = game:GetService("UserInputService")
- local TweenService = game:GetService("TweenService")
- local Debris = game:GetService("Debris")
- local Workspace = game:GetService("Workspace")
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local Players = game:GetService("Players")
- local Tool = script.Parent
- local Handle = Tool:WaitForChild("Handle")
- local Player = Players.LocalPlayer
- local Character = Workspace:WaitForChild(Player.Name)
- local Humanoid = Character:WaitForChild("Humanoid")
- local Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("UpperTorso")
- local PlayerGui = Player:WaitForChild("PlayerGui")
- local Mouse = Player:GetMouse()
- local Camera = Workspace.CurrentCamera
- local GunScript_Server = Tool:WaitForChild("GunScript_Server")
- local GUI = script:WaitForChild("GunGUI")
- local AimButton = GUI.MobileButtons.AimButton
- local FireButton = GUI.MobileButtons.FireButton
- local HoldDownButton = GUI.MobileButtons.HoldDownButton
- local InspectButton = GUI.MobileButtons.InspectButton
- local ReloadButton = GUI.MobileButtons.ReloadButton
- local SwitchButton = GUI.MobileButtons.SwitchButton
- local MeleeButton = GUI.MobileButtons.MeleeButton
- local CrossFrame = GUI.Crosshair.Main
- local CrossParts = {game.WaitForChild(CrossFrame, "HR"), game.WaitForChild(CrossFrame, "HL"), game.WaitForChild(CrossFrame, "VD"), game.WaitForChild(CrossFrame, "VU")}
- local TouchGui
- local TouchControlFrame
- local JumpButton
- if UserInputService.TouchEnabled then
- TouchGui = PlayerGui:WaitForChild("TouchGui")
- TouchControlFrame = TouchGui:WaitForChild("TouchControlFrame")
- JumpButton = TouchControlFrame:WaitForChild("JumpButton")
- end
- local MarkerEvent = script:WaitForChild("MarkerEvent")
- local ChangeMagAndAmmo = GunScript_Server:WaitForChild("ChangeMagAndAmmo")
- local InflictTargetMelee = GunScript_Server:WaitForChild("InflictTargetMelee")
- local MagValue = GunScript_Server:WaitForChild("Mag")
- local AmmoValue = GunScript_Server:WaitForChild("Ammo")
- local HeatValue = GunScript_Server:WaitForChild("Heat")
- local Miscs = ReplicatedStorage:WaitForChild("Miscs")
- local Modules = ReplicatedStorage:WaitForChild("Modules")
- local Remotes = ReplicatedStorage:WaitForChild("Remotes")
- local GunVisualEffects = Miscs.GunVisualEffects
- local VisualEffects = GunVisualEffects[Tool.Name]
- local Module = require(Tool:WaitForChild("Setting"))
- local ViewmodelHandler = require(Modules.ViewmodelHandler)
- local ProjectileHandler = require(Modules.ProjectileHandler)
- local MuzzleHandler = require(Modules.MuzzleHandler)
- local AudioHandler = require(Modules.AudioHandler)
- local SmokeTrail = require(Modules.SmokeTrail)
- local DamageModule = require(Modules.DamageModule)
- local Utilities = require(Modules.Utilities)
- local Thread = Utilities.Thread
- local ProjectileMotion = Utilities.ProjectileMotion
- local Math = Utilities.Math
- local ShatterGlass = Remotes.ShatterGlass
- local BindToStepName = "UpdateGun_"..HttpService:GenerateGUID()
- --Viewmodel
- local Viewmodel
- local FakeCamera
- local VMHandle
- local VMHandle2
- local VMHandleToFire
- local VMHandleCounts = 1
- local CFAngles
- --
- local Grip2
- local Handle2
- local HandleToFire = Handle
- local Beam, Attach0, Attach1
- local LockedEntity
- local Animations = {}
- local VMAnimations = {}
- local Keyframes = {}
- local KeyframeConnections = {}
- local VMKeyframes = {}
- local VMKeyframeConnections = {}
- local TwoDeeShells = {}
- if Module.MagCartridge and not Module.BatteryEnabled and Module.AmmoPerMag ~= math.huge then
- for i = 1, Module.AmmoPerMag do
- local Bullet = GUI.MagCartridge.UIGridLayout.Template:Clone()
- Bullet.Name = i
- Bullet.LayoutOrder = i
- Bullet.Parent = GUI.MagCartridge
- end
- end
- local Spring = Utilities.Spring
- local OldPosition = Vector2.new()
- --scope
- --for the scope wiggle
- local Scope = Spring.spring.new(Vector3.new(0, 200, 0))
- Scope.s = Module.ScopeSwaySpeed
- Scope.d = Module.ScopeSwayDamper
- --for the knockback wiggle
- local Knockback = Spring.spring.new(Vector3.new())
- Knockback.s = Module.ScopeKnockbackSpeed
- Knockback.d = Module.ScopeKnockbackDamper
- --camera
- local CameraSpring = Spring.spring.new(Vector3.new())
- CameraSpring.s = Module.RecoilSpeed
- CameraSpring.d = Module.RecoilDamper
- --crosshair
- local CrossScale = Spring.spring.new(0)
- CrossScale.s = 10
- CrossScale.d = 0.8
- CrossScale.t = 1
- local CrossSpring = Spring.spring.new(0)
- CrossSpring.s = 12
- CrossSpring.d = 0.65
- if Module.DualEnabled then
- Handle2 = Tool:WaitForChild("Handle2", 2)
- if Handle2 == nil and Module.DualEnabled then error("\"Dual\" setting is enabled but \"Handle2\" is missing!") end
- end
- local TopbarOffset = (GUI.IgnoreGuiInset and GuiService:GetGuiInset()) or Vector2.new(0, 0)
- local Killzone = GUI.AbsoluteSize.Y + TopbarOffset.Y + 100
- local TargetMarker = script:WaitForChild("TargetMarker"):Clone()
- local Variables = {
- Equipped = false;
- ActuallyEquipped = false;
- Enabled = true;
- Down = false;
- HoldDown = false;
- Reloading = false;
- AimDown = false;
- Scoping = false;
- Inspecting = false;
- Charging = false;
- Charged = false;
- Switching = false;
- Overheated = false;
- CanBeCooledDown = true;
- Mag = MagValue.Value;
- Ammo = AmmoValue.Value;
- Heat = HeatValue.Value;
- MaxAmmo = Module.MaxAmmo;
- CurrentRate = 0;
- LastRate = 0;
- ElapsedTime = 0;
- ElapsedCooldownTime = 0;
- ChargeLevel = 0;
- FireModes = Module.FireModes;
- FireMode = 1;
- ShotsForDepletion = 0;
- ShotID = 0;
- twoDeeShellCount = 0;
- InitialSensitivity = UserInputService.MouseDeltaSensitivity;
- }
- local function FindAnimationNameForKeyframe(AnimObject, IsViewmodel)
- if IsViewmodel then
- if Module.VMAnimationKeyframes[AnimObject.Name] then
- table.insert(VMKeyframes, {AnimObject, Module.VMAnimationKeyframes[AnimObject.Name]})
- end
- else
- if Module.AnimationKeyframes[AnimObject.Name] then
- table.insert(Keyframes, {AnimObject, Module.AnimationKeyframes[AnimObject.Name]})
- end
- end
- end
- if Module.IdleAnimationID ~= nil or Module.DualEnabled then
- Animations.IdleAnim = Tool:WaitForChild("IdleAnim")
- Animations.IdleAnim = Humanoid:LoadAnimation(Animations.IdleAnim)
- FindAnimationNameForKeyframe(Animations.IdleAnim)
- end
- if Module.FireAnimationID ~= nil then
- Animations.FireAnim = Tool:WaitForChild("FireAnim")
- Animations.FireAnim = Humanoid:LoadAnimation(Animations.FireAnim)
- FindAnimationNameForKeyframe(Animations.FireAnim)
- end
- if Module.ReloadAnimationID ~= nil then
- Animations.ReloadAnim = Tool:WaitForChild("ReloadAnim")
- Animations.ReloadAnim = Humanoid:LoadAnimation(Animations.ReloadAnim)
- FindAnimationNameForKeyframe(Animations.ReloadAnim)
- --wait(0.85)
- --script.Parent.M416.Mag.Transparency = 1
- --wait(0.15)
- --script.Parent.M416.Mag.Transparency = 0
- end
- if Module.ShotgunClipinAnimationID ~= nil then
- Animations.ShotgunClipinAnim = Tool:WaitForChild("ShotgunClipinAnim")
- Animations.ShotgunClipinAnim = Humanoid:LoadAnimation(Animations.ShotgunClipinAnim)
- FindAnimationNameForKeyframe(Animations.ShotgunClipinAnim)
- end
- if Module.ShotgunPumpinAnimationID ~= nil then
- Animations.ShotgunPumpinAnim = Tool:WaitForChild("ShotgunPumpinAnim")
- Animations.ShotgunPumpinAnim = Humanoid:LoadAnimation(Animations.ShotgunPumpinAnim)
- FindAnimationNameForKeyframe(Animations.ShotgunPumpinAnim)
- end
- if Module.SecondaryShotgunPumpinAnimationID ~= nil then
- Animations.SecondaryShotgunPumpinAnim = Tool:WaitForChild("SecondaryShotgunPumpinAnim")
- Animations.SecondaryShotgunPumpinAnim = Humanoid:LoadAnimation(Animations.SecondaryShotgunPumpinAnim)
- FindAnimationNameForKeyframe(Animations.SecondaryShotgunPumpinAnim)
- end
- if Module.HoldDownAnimationID ~= nil then
- Animations.HoldDownAnim = Tool:WaitForChild("HoldDownAnim")
- Animations.HoldDownAnim = Humanoid:LoadAnimation(Animations.HoldDownAnim)
- FindAnimationNameForKeyframe(Animations.HoldDownAnim)
- end
- if Module.EquippedAnimationID ~= nil then
- Animations.EquippedAnim = Tool:WaitForChild("EquippedAnim")
- Animations.EquippedAnim = Humanoid:LoadAnimation(Animations.EquippedAnim)
- FindAnimationNameForKeyframe(Animations.EquippedAnim)
- end
- if Module.SecondaryFireAnimationEnabled and Module.SecondaryFireAnimationID ~= nil then
- Animations.SecondaryFireAnim = Tool:WaitForChild("SecondaryFireAnim")
- Animations.SecondaryFireAnim = Humanoid:LoadAnimation(Animations.SecondaryFireAnim)
- FindAnimationNameForKeyframe(Animations.SecondaryFireAnim)
- end
- if Module.AimAnimationsEnabled and Module.AimIdleAnimationID ~= nil then
- Animations.AimIdleAnim = Tool:WaitForChild("AimIdleAnim")
- Animations.AimIdleAnim = Humanoid:LoadAnimation(Animations.AimIdleAnim)
- FindAnimationNameForKeyframe(Animations.AimIdleAnim)
- end
- if Module.AimAnimationsEnabled and Module.AimFireAnimationID ~= nil then
- Animations.AimFireAnim = Tool:WaitForChild("AimFireAnim")
- Animations.AimFireAnim = Humanoid:LoadAnimation(Animations.AimFireAnim)
- FindAnimationNameForKeyframe(Animations.AimFireAnim)
- end
- if Module.AimAnimationsEnabled and Module.AimSecondaryFireAnimationID ~= nil then
- Animations.AimSecondaryFireAnim = Tool:WaitForChild("AimSecondaryFireAnim")
- Animations.AimSecondaryFireAnim = Humanoid:LoadAnimation(Animations.AimSecondaryFireAnim)
- FindAnimationNameForKeyframe(Animations.AimSecondaryFireAnim)
- end
- if Module.AimAnimationsEnabled and Module.AimChargingAnimationID ~= nil then
- Animations.AimChargingAnim = Tool:WaitForChild("AimChargingAnim")
- Animations.AimChargingAnim = Humanoid:LoadAnimation(Animations.AimChargingAnim)
- FindAnimationNameForKeyframe(Animations.AimChargingAnim)
- end
- if Module.TacticalReloadAnimationEnabled and Module.TacticalReloadAnimationID ~= nil then
- Animations.TacticalReloadAnim = Tool:WaitForChild("TacticalReloadAnim")
- Animations.TacticalReloadAnim = Humanoid:LoadAnimation(Animations.TacticalReloadAnim)
- FindAnimationNameForKeyframe(Animations.TacticalReloadAnim)
- end
- if Module.InspectAnimationEnabled and Module.InspectAnimationID ~= nil then
- Animations.InspectAnim = Tool:WaitForChild("InspectAnim")
- Animations.InspectAnim = Humanoid:LoadAnimation(Animations.InspectAnim)
- FindAnimationNameForKeyframe(Animations.InspectAnim)
- end
- if Module.ShotgunReload and Module.PreShotgunReload and Module.PreShotgunReloadAnimationID ~= nil then
- Animations.PreShotgunReloadAnim = Tool:WaitForChild("PreShotgunReloadAnim")
- Animations.PreShotgunReloadAnim = Humanoid:LoadAnimation(Animations.PreShotgunReloadAnim)
- FindAnimationNameForKeyframe(Animations.PreShotgunReloadAnim)
- end
- if Module.MinigunRevUpAnimationID ~= nil then
- Animations.MinigunRevUpAnim = Tool:WaitForChild("MinigunRevUpAnim")
- Animations.MinigunRevUpAnim = Humanoid:LoadAnimation(Animations.MinigunRevUpAnim)
- FindAnimationNameForKeyframe(Animations.MinigunRevUpAnim)
- end
- if Module.MinigunRevDownAnimationID ~= nil then
- Animations.MinigunRevDownAnim = Tool:WaitForChild("MinigunRevDownAnim")
- Animations.MinigunRevDownAnim = Humanoid:LoadAnimation(Animations.MinigunRevDownAnim)
- FindAnimationNameForKeyframe(Animations.MinigunRevDownAnim)
- end
- if Module.ChargingAnimationEnabled and Module.ChargingAnimationID ~= nil then
- Animations.ChargingAnim = Tool:WaitForChild("ChargingAnim")
- Animations.ChargingAnim = Humanoid:LoadAnimation(Animations.ChargingAnim)
- FindAnimationNameForKeyframe(Animations.ChargingAnim)
- end
- if Module.SelectiveFireEnabled and Module.SwitchAnimationID ~= nil then
- Animations.SwitchAnim = Tool:WaitForChild("SwitchAnim")
- Animations.SwitchAnim = Humanoid:LoadAnimation(Animations.SwitchAnim)
- FindAnimationNameForKeyframe(Animations.SwitchAnim)
- end
- if Module.BatteryEnabled and Module.OverheatAnimationID ~= nil then
- Animations.OverheatAnim = Tool:WaitForChild("OverheatAnim")
- Animations.OverheatAnim = Humanoid:LoadAnimation(Animations.OverheatAnim)
- FindAnimationNameForKeyframe(Animations.OverheatAnim)
- end
- if Module.MeleeAttackEnabled and Module.MeleeAttackAnimationID ~= nil then
- Animations.MeleeAttackAnim = Tool:WaitForChild("MeleeAttackAnim")
- Animations.MeleeAttackAnim = Humanoid:LoadAnimation(Animations.MeleeAttackAnim)
- FindAnimationNameForKeyframe(Animations.MeleeAttackAnim)
- end
- local CurrentAimFireAnim
- local CurrentAimFireAnimationSpeed
- if Module.AimAnimationsEnabled then
- CurrentAimFireAnim = Animations.AimFireAnim
- CurrentAimFireAnimationSpeed = Module.AimFireAnimationSpeed
- end
- local CurrentFireAnim = Animations.FireAnim
- local CurrentFireAnimationSpeed = Module.FireAnimationSpeed
- local CurrentShotgunPumpinAnim = Animations.ShotgunPumpinAnim
- local CurrentShotgunPumpinAnimationSpeed = Module.ShotgunPumpinSpeed
- --Viewmodel
- local CurrentVMFireAnim
- local CurrentVMFireAnimationSpeed
- local CurrentVMShotgunPumpinAnim
- local CurrentVMShotgunPumpinAnimationSpeed
- local function SetCrossScale(Scale)
- CrossScale.t = Scale
- end
- local function SetCrossSize(Size)
- CrossSpring.t = Size
- end
- local function SetCrossSettings(Size, Speed, Damper)
- CrossSpring.t = Size
- CrossSpring.s = Speed
- CrossSpring.d = Damper
- end
- local function Random2DDirection(Velocity, X, Y)
- return Vector2.new(X, Y) * (Velocity or 1)
- end
- local function AddressTableValue(v1, v2)
- if v1 ~= nil and Module.ChargedShotAdvanceEnabled then
- return ((Variables.ChargeLevel == 1 and v1.Level1) or (Variables.ChargeLevel == 2 and v1.Level2) or (Variables.ChargeLevel == 3 and v1.Level3) or v2)
- else
- return v2
- end
- end
- local function PopulateHumanoids(mdl)
- if mdl.ClassName == "Humanoid" then
- if DamageModule.CanDamage(mdl.Parent, Character, Module.FriendlyFire) then
- table.insert(Humanoids, mdl)
- end
- end
- for i2, mdl2 in ipairs(mdl:GetChildren()) do
- PopulateHumanoids(mdl2)
- end
- end
- local function CastRay(StartPos, Direction, Length)
- local Hit, EndPos = Workspace:FindPartOnRayWithIgnoreList(Ray.new(StartPos,Direction * Length), {Camera, Tool.Parent})
- if Hit then
- local FirePointObject = (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 and VMHandleToFire:FindFirstChild("GunFirePoint") or HandleToFire:FindFirstChild("GunFirePoint")
- if FirePointObject ~= nil then
- local TipCFrame = FirePointObject.WorldCFrame
- local TipPos = TipCFrame.Position
- local TipDir = TipCFrame.LookVector
- local AmountToCheatBack = math.abs((Character.Head.Position - TipPos):Dot(TipDir)) + 1
- local GunRay = Ray.new(TipPos - TipDir.Unit * AmountToCheatBack, TipDir.Unit * AmountToCheatBack)
- local HitPart, HitPoint = Workspace:FindPartOnRayWithIgnoreList(GunRay, {Camera, Tool.Parent}, false, true)
- if HitPart and math.abs((TipPos - HitPoint).Magnitude) > 0 then
- return CastRay(EndPos + (Direction * 0.01), Direction, Length - ((StartPos - EndPos).Magnitude))
- end
- end
- end
- return EndPos
- end
- local function Get3DPosition(CurrentPosOnScreen)
- local InputRay = Camera:ScreenPointToRay(CurrentPosOnScreen.X, CurrentPosOnScreen.Y)
- local EndPos = InputRay.Origin + InputRay.Direction
- return CastRay(Camera.CFrame.p, (EndPos - Camera.CFrame.p).Unit, 5000)
- end
- local function FindNearestEntity()
- Humanoids = {}
- PopulateHumanoids(workspace)
- local MinOffset
- local TargetModel = nil
- local TargetHumanoid = nil
- local TargetTorso = nil
- for i, v in ipairs(Humanoids) do
- local torso = v.Parent:FindFirstChild("HumanoidRootPart") or v.Parent:FindFirstChild("Torso") or v.Parent:FindFirstChild("UpperTorso")
- if v and torso then
- local Dist = (Character.Head.Position - torso.Position).Magnitude
- local MousePos = Get3DPosition(GUI.Crosshair.AbsolutePosition)
- local MouseDirection = (MousePos - Character.Head.Position).Unit
- local Offset = (((MouseDirection * Dist) + Character.Head.Position) - torso.Position).Magnitude
- if Offset < Module.LockOnRadius and (not MinOffset or Offset < MinOffset) and v.Health > 0 then
- if DamageModule.CanDamage(v.Parent, Character, Module.FriendlyFire) then
- TargetModel = v.Parent
- TargetHumanoid = v
- TargetTorso = torso
- end
- end
- end
- end
- return TargetModel, TargetHumanoid, TargetTorso
- end
- local function WorldToScreen(Viewpoint)
- local ToObjectSpace = Camera.CFrame:pointToObjectSpace(Viewpoint)
- local FieldOfView = math.tan(math.rad(Camera.FieldOfView) / 2)
- 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)))
- end
- local function UpdateGUI()
- GUI.Frame.Mag.Fill:TweenSize(UDim2.new(Variables.Mag / Module.AmmoPerMag, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.25, true)
- GUI.Frame.Ammo.Fill:TweenSize(UDim2.new(Variables.Ammo / Module.MaxAmmo, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.25, true)
- GUI.Frame.Heat.Fill:TweenSize(UDim2.new(Variables.Heat / Module.MaxHeat, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.25, true)
- GUI.Frame.Mag.Current.Text = Variables.Mag
- GUI.Frame.Mag.Max.Text = Module.AmmoPerMag
- GUI.Frame.Mag.FireMode.Text = Module.FireModeTexts[Variables.FireMode]
- GUI.Frame.Ammo.Current.Text = Variables.Ammo
- GUI.Frame.Ammo.Max.Text = Module.MaxAmmo
- GUI.Frame.Heat.Current.Text = Variables.Heat
- GUI.Frame.Heat.Max.Text = Module.MaxHeat
- GUI.Frame.Heat.FireMode.Text = Module.FireModeTexts[Variables.FireMode]
- GUI.Frame.Mag.Current.Visible = not Variables.Reloading
- GUI.Frame.Mag.Max.Visible = not Variables.Reloading
- GUI.Frame.Mag.Frame.Visible = not Variables.Reloading
- GUI.Frame.Mag.Reloading.Visible = Variables.Reloading
- GUI.Frame.Mag.FireMode.Visible = Module.SelectiveFireEnabled
- GUI.Frame.Ammo.Current.Visible = not (Variables.Ammo <= 0)
- GUI.Frame.Ammo.Max.Visible = not (Variables.Ammo <= 0)
- GUI.Frame.Ammo.Frame.Visible = not (Variables.Ammo <= 0)
- GUI.Frame.Ammo.NoMoreAmmo.Visible = (Variables.Ammo <= 0)
- GUI.Frame.Heat.Visible = Module.BatteryEnabled
- GUI.Frame.Heat.Current.Visible = not Variables.Overheated
- GUI.Frame.Heat.Max.Visible = not Variables.Overheated
- GUI.Frame.Heat.Frame.Visible = not Variables.Overheated
- GUI.Frame.Heat.Overheated.Visible = Variables.Overheated
- GUI.Frame.Heat.FireMode.Visible = Module.SelectiveFireEnabled
- GUI.ChargeBar.Visible = (Module.ChargedShotAdvanceEnabled or Module.HoldAndReleaseEnabled)
- GUI.ChargeBar.Level1.Visible = not Module.HoldAndReleaseEnabled
- GUI.ChargeBar.Level2.Visible = not Module.HoldAndReleaseEnabled
- GUI.ChargeBar.Level1.Position = UDim2.new(Module.Level1ChargingTime / Module.AdvancedChargingTime, 0, 0.5, 0)
- GUI.ChargeBar.Level2.Position = UDim2.new(Module.Level2ChargingTime / Module.AdvancedChargingTime, 0, 0.5, 0)
- GUI.ChargeBar.Position = Module.MagCartridge and UDim2.new(1, -260, 1, -70) or UDim2.new(1, -260, 1, -35)
- GUI.MagCartridge.Visible = Module.MagCartridge
- GUI.Frame.Mag.Visible = not Module.BatteryEnabled
- GUI.Frame.Ammo.Visible = Module.LimitedAmmoEnabled
- GUI.Frame.Heat.Visible = Module.BatteryEnabled
- GUI.Frame.Size = Module.LimitedAmmoEnabled and UDim2.new(0, 250, 0, 100) or UDim2.new(0, 250, 0, 55)
- 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)))
- GUI.MobileButtons.Visible = UserInputService.TouchEnabled --For mobile version
- AimButton.Visible = Module.SniperEnabled or Module.IronsightEnabled
- HoldDownButton.Visible = Module.HoldDownEnabled
- InspectButton.Visible = Module.InspectAnimationEnabled
- SwitchButton.Visible = Module.SelectiveFireEnabled
- ReloadButton.Visible = not Module.BatteryEnabled
- MeleeButton.Visible = Module.MeleeAttackEnabled
- end
- local function RenderScope()
- Knockback.t = Knockback.t:Lerp(Vector3.new(), 0.2)
- end
- local function RenderMouse()
- local Delta = UserInputService:GetMouseDelta() / Module.ScopeSensitive
- local Offset = GUI.Scope.AbsoluteSize.X * 0.5
- if Variables.Scoping and UserInputService.MouseEnabled and UserInputService.KeyboardEnabled then --For pc version
- GUI.Scope.Position = UDim2.new(0, Scope.p.X + (Knockback.p.Y * 1000), 0, Scope.p.Y + (Knockback.p.X * 200))
- Scope.t = Vector3.new(Mouse.X - Offset - Delta.X, Mouse.Y - Offset - Delta.Y, 0)
- OldPosition = Vector2.new(Mouse.X, Mouse.Y)
- elseif Variables.Scoping and UserInputService.TouchEnabled and not UserInputService.MouseEnabled and not UserInputService.KeyboardEnabled then --For mobile version, but in first-person view
- GUI.Scope.Position = UDim2.new(0, Scope.p.X + (Knockback.p.Y * 1000), 0, Scope.p.Y + (Knockback.p.X * 200))
- Scope.t = Vector3.new(GUI.Crosshair.AbsolutePosition.X - Offset - Delta.X, GUI.Crosshair.AbsolutePosition.Y - Offset - Delta.Y, 0)
- OldPosition = Vector2.new(GUI.Crosshair.AbsolutePosition.X, GUI.Crosshair.AbsolutePosition.Y)
- end
- GUI.Scope.Visible = Variables.Scoping
- if not Variables.Scoping then
- GUI.Crosshair.Main.Visible = true
- Scope.t = Vector3.new(600, 200, 0)
- else
- GUI.Crosshair.Main.Visible = false
- end
- if UserInputService.MouseEnabled and UserInputService.KeyboardEnabled then --For pc version
- if FakeCamera then
- CFAngles = CFrame.fromEulerAnglesXYZ(FakeCamera.Transform:ToEulerAnglesXYZ()) or CFrame.new()
- if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 then
- if CFAngles then
- local v = WorldToScreen((Camera.CFrame * CFAngles:Inverse() * CFrame.new(0, 0, -4)).Position)
- local v2 = Camera.ViewportSize / 2
- 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)
- else
- GUI.Crosshair.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y)
- end
- else
- GUI.Crosshair.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y)
- end
- else
- GUI.Crosshair.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y)
- end
- 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
- GUI.Crosshair.Position = UDim2.new(0.5, 0, 0.4, -50)
- 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
- if FakeCamera then
- CFAngles = CFrame.fromEulerAnglesXYZ(FakeCamera.Transform:ToEulerAnglesXYZ()) or CFrame.new()
- if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 then
- if CFAngles then
- local v = WorldToScreen((Camera.CFrame * CFAngles:Inverse() * CFrame.new(0, 0, -4)).Position)
- local v2 = Camera.ViewportSize / 2
- 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)
- else
- GUI.Crosshair.Position = UDim2.new(0.5, 0, 0.5, -19)
- end
- else
- GUI.Crosshair.Position = UDim2.new(0.5, 0, 0.5, -19)
- end
- else
- GUI.Crosshair.Position = UDim2.new(0.5, 0, 0.5, -19)
- end
- end
- if AddressTableValue(Module.ChargeAlterTable.Homing, Module.Homing) and Module.LockOnOnHovering and not Module.HitscanMode then
- local TargetEntity, TargetHumanoid, TargetTorso = FindNearestEntity()
- if TargetEntity and TargetHumanoid and TargetTorso then
- LockedEntity = TargetEntity
- TargetMarker.Parent = GUI
- TargetMarker.Adornee = TargetTorso
- TargetMarker.Enabled = true
- else
- LockedEntity = nil
- TargetMarker.Enabled = false
- TargetMarker.Parent = nil
- TargetMarker.Adornee = nil
- end
- end
- end
- local function RenderCam()
- Camera.CoordinateFrame = Camera.CoordinateFrame * CFrame.Angles(CameraSpring.p.X, CameraSpring.p.Y, CameraSpring.p.Z)
- end
- local function RenderCrosshair()
- local Size = CrossSpring.p * 4 * CrossScale.p --* (char.speed / 14 * (1 - 0.8) * 2 + 0.8)*(char.sprint + 1) / 2
- for i = 1, 4 do
- CrossParts[i].BackgroundTransparency = 1 - Size / 20
- end
- CrossParts[1].Position = UDim2.new(0, Size, 0, 0)
- CrossParts[2].Position = UDim2.new(0, -Size - 7, 0, 0)
- CrossParts[3].Position = UDim2.new(0, 0, 0, Size)
- CrossParts[4].Position = UDim2.new(0, 0, 0, -Size - 7)
- end
- local function RenderRate(dt)
- Variables.ElapsedTime = Variables.ElapsedTime + dt
- if Variables.ElapsedTime >= 1 then
- Variables.ElapsedTime = 0
- Variables.CurrentRate = Variables.CurrentRate - Variables.LastRate
- Variables.LastRate = Variables.CurrentRate
- end
- end
- local function RenderMotion()
- local Position = Get3DPosition(GUI.Crosshair.AbsolutePosition)
- 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)
- local direction = cframe.lookVector
- if direction then
- 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))
- end
- end
- local function RenderCooldown(dt)
- Variables.ElapsedCooldownTime = Variables.ElapsedCooldownTime + dt
- if Variables.ElapsedCooldownTime >= Module.CooldownTime then
- Variables.ElapsedCooldownTime = 0
- if not Variables.Down then
- if not Variables.Overheated then
- if Variables.CanBeCooledDown then
- if Variables.Heat > 0 then
- Variables.Heat = math.clamp(Variables.Heat - Module.CooldownRate, 0, Module.MaxHeat)
- UpdateGUI()
- ChangeMagAndAmmo:FireServer(Variables.Mag, Variables.Ammo, Variables.Heat)
- end
- end
- end
- end
- end
- end
- local function RenderTwoDeeShell(dt)
- local Drag = Module.Drag ^ dt
- for twoDeeShell, data in pairs(TwoDeeShells) do
- if twoDeeShell.Parent then
- data.Vel = (data.Vel * Drag) + Module.Gravity * dt
- data.Pos = data.Pos + data.Vel * dt
- data.RotVel = data.RotVel * Drag
- data.Rot = data.Rot + data.RotVel * dt
- twoDeeShell.Position = UDim2.new(0, data.Pos.X, 0, data.Pos.Y)
- twoDeeShell.Rotation = data.Rot
- if twoDeeShell.AbsolutePosition.Y > Killzone then
- twoDeeShell:Destroy()
- Variables.twoDeeShellCount = Variables.twoDeeShellCount - 1
- TwoDeeShells[twoDeeShell] = nil
- end
- else
- Variables.twoDeeShellCount = Variables.twoDeeShellCount - 1
- TwoDeeShells[twoDeeShell] = nil
- end
- end
- end
- --[[local function RenderScopeOLD(dt)
- if Variables.Scoping and UserInputService.MouseEnabled and UserInputService.KeyboardEnabled then --For pc version
- 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)
- GUI.Scope.Position = UDim2.new(0, Mouse.X - GUI.Scope.AbsoluteSize.X / 2, 0, Mouse.Y - GUI.Scope.AbsoluteSize.Y / 2)
- elseif Variables.Scoping and UserInputService.TouchEnabled and not UserInputService.MouseEnabled and not UserInputService.KeyboardEnabled then --For mobile version, but in first-person view
- 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)
- 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)
- else
- GUI.Scope.Size = UDim2.new(0.6, 36, 0.6, 36)
- GUI.Scope.Position = UDim2.new(0, 0, 0, 0)
- end
- GUI.Scope.Visible = Variables.Scoping
- if UserInputService.MouseEnabled and UserInputService.KeyboardEnabled then --For pc version
- GUI.Crosshair.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y)
- 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
- GUI.Crosshair.Position = UDim2.new(0.5, 0, 0.4, -50)
- 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
- GUI.Crosshair.Position = UDim2.new(0.5, -1, 0.5, -19)
- end
- end]]
- local function MarkHit(IsHeadshot)
- --pcall(function()
- if Module.HitmarkerEnabled then
- if IsHeadshot then
- GUI.Crosshair.Hitmarker.ImageColor3 = Module.HitmarkerColorHS
- GUI.Crosshair.Hitmarker.ImageTransparency = 0
- TweenService:Create(GUI.Crosshair.Hitmarker, TweenInfo.new(Module.HitmarkerFadeTimeHS, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {ImageTransparency = 1}):Play()
- local MarkerSound = GUI.Crosshair.MarkerSound:Clone()
- MarkerSound.SoundId = "rbxassetid://"..Module.HitmarkerSoundID[math.random(1, #Module.HitmarkerSoundID)]
- MarkerSound.PlaybackSpeed = Module.HitmarkerSoundPitchHS
- MarkerSound.Parent = Player.PlayerGui
- MarkerSound:Play()
- MarkerSound.Ended:Connect(function()
- MarkerSound:Destroy()
- end)
- else
- GUI.Crosshair.Hitmarker.ImageColor3 = Module.HitmarkerColor
- GUI.Crosshair.Hitmarker.ImageTransparency = 0
- TweenService:Create(GUI.Crosshair.Hitmarker, TweenInfo.new(Module.HitmarkerFadeTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {ImageTransparency = 1}):Play()
- local MarkerSound = GUI.Crosshair.MarkerSound:Clone()
- MarkerSound.SoundId = "rbxassetid://"..Module.HitmarkerSoundID[math.random(1, #Module.HitmarkerSoundID)]
- MarkerSound.PlaybackSpeed = Module.HitmarkerSoundPitch
- MarkerSound.Parent = Player.PlayerGui
- MarkerSound:Play()
- MarkerSound.Ended:Connect(function()
- MarkerSound:Destroy()
- end)
- end
- end
- --end)
- end
- local function EjectShell(ShootingHandle)
- if Module.BulletShellEnabled then
- if Module.BulletShellParticles then
- local function Spawner()
- for i, v in pairs(VisualEffects.ShellEjectEffect:GetChildren()) do
- if v.ClassName == "ParticleEmitter" then
- local Count = 1
- local Particle = v:Clone()
- Particle.Parent = ShootingHandle.ShellEjectParticlePoint
- if Particle:FindFirstChild("EmitCount") then
- Count = Particle.EmitCount.Value
- end
- Thread:Delay(0.01, function()
- Particle:Emit(Count)
- Debris:AddItem(Particle, Particle.Lifetime.Max)
- end)
- end
- end
- end
- Thread:Spawn(Spawner)
- end
- local Shell = Instance.new("Part")
- Shell.CFrame = ShootingHandle.ShellEjectPoint.WorldCFrame
- Shell.Size = Module.ShellSize
- Shell.CanCollide = Module.AllowCollide
- Shell.Name = "Shell"
- Shell.Velocity = ShootingHandle.ShellEjectPoint.WorldCFrame.LookVector * Module.BulletShellVelocity
- Shell.RotVelocity = ShootingHandle.ShellEjectPoint.WorldCFrame.LookVector * Module.BulletShellRotVelocity
- Shell.Parent = Camera
- local Shellmesh = Instance.new("SpecialMesh")
- Shellmesh.Scale = Module.ShellScale
- Shellmesh.MeshId = "rbxassetid://"..Module.ShellMeshID
- Shellmesh.TextureId = "rbxassetid://"..Module.ShellTextureID
- Shellmesh.MeshType = "FileMesh"
- Shellmesh.Parent = Shell
- Debris:AddItem(Shell, Module.DisappearTime)
- end
- end
- local function RecoilCamera()
- if Module.CameraRecoilingEnabled then
- local Recoil = AddressTableValue(Module.ChargeAlterTable.Recoil, Module.Recoil)
- local CurrentRecoil = Recoil * (Variables.AimDown and 1 - Module.RecoilRedution or 1)
- local RecoilX = math.rad(CurrentRecoil * Math.Randomize2(Module.AngleX_Min, Module.AngleX_Max, Module.Accuracy))
- local RecoilY = math.rad(CurrentRecoil * Math.Randomize2(Module.AngleY_Min, Module.AngleY_Max, Module.Accuracy))
- local RecoilZ = math.rad(CurrentRecoil * Math.Randomize2(Module.AngleZ_Min, Module.AngleZ_Max, Module.Accuracy))
- Knockback:Accelerate(Vector3.new(-RecoilX * Module.ScopeKnockbackMultiplier, -RecoilY * Module.ScopeKnockbackMultiplier, 0))
- CameraSpring:Accelerate(Vector3.new(RecoilX, RecoilY, RecoilZ))
- Thread:Wait(0.03)
- CameraSpring:Accelerate(Vector3.new(-RecoilX, -RecoilY, 0))
- end
- end
- local function SelfKnockback(p1, p2)
- local SelfKnockbackPower = AddressTableValue(Module.ChargeAlterTable.SelfKnockbackPower, Module.SelfKnockbackPower)
- local SelfKnockbackMultiplier = AddressTableValue(Module.ChargeAlterTable.SelfKnockbackMultiplier, Module.SelfKnockbackMultiplier)
- local SelfKnockbackRedution = AddressTableValue(Module.ChargeAlterTable.SelfKnockbackRedution, Module.SelfKnockbackRedution)
- local Power = Humanoid:GetState() ~= Enum.HumanoidStateType.Freefall and SelfKnockbackPower * SelfKnockbackMultiplier * (1 - SelfKnockbackRedution) or SelfKnockbackPower * SelfKnockbackMultiplier
- local VelocityMod = (p1 - p2).Unit
- local AirVelocity = Torso.Velocity - Vector3.new(0, Torso.Velocity.Y, 0) + Vector3.new(VelocityMod.X, 0, VelocityMod.Z) * -Power
- local TorsoFly = Instance.new("BodyVelocity")
- TorsoFly.MaxForce = Vector3.new(math.huge, 0, math.huge)
- TorsoFly.Velocity = AirVelocity
- TorsoFly.Parent = Torso
- Torso.Velocity = Torso.Velocity + Vector3.new(0, VelocityMod.Y * 2, 0) * -Power
- Debris:AddItem(TorsoFly, 0.25)
- end
- local function CreateTwoDeeShell(ObjRot, Pos, Size, Vel, type, shockwave)
- local MaxedOut = Variables.twoDeeShellCount >= Module.MaxCount
- if MaxedOut and Module.RemoveOldAtMax and math.random() then
- -- This is the best method I can figure for removing a random item from a dictionary of known length
- local RemoveCoutndown = math.random(1, Module.MaxCount)
- for twoDeeShell, _ in pairs(TwoDeeShells) do
- RemoveCoutndown = RemoveCoutndown - 1
- if RemoveCoutndown <= 0 then
- twoDeeShell:Destroy()
- Variables.twoDeeShellCount = Variables.twoDeeShellCount - 1
- TwoDeeShells[twoDeeShell] = nil
- MaxedOut = Variables.twoDeeShellCount >= Module.MaxCount
- break
- end
- end
- end
- if not MaxedOut then
- Variables.twoDeeShellCount = Variables.twoDeeShellCount + 1
- local Rot = ObjRot --math.random() * 360
- local XCenter = Pos.X + (Size.X / 2)
- local YCenter = Pos.Y + (Size.Y / 2)
- local Data = {
- RotVel = (math.random() * 2 - 1) * Module.MaxRotationSpeed,
- Rot = Rot,
- Pos = (Pos and Vector2.new(XCenter, YCenter) or Vector2.new(0, 0)) + TopbarOffset,
- Vel = Vel or Vector2.new(0, 0),
- }
- local TwoDeeShell = GUI.MagCartridge.UIGridLayout.Shell
- if type == "bullet" then
- TwoDeeShell = GUI.MagCartridge.UIGridLayout.Template
- end
- local Clone = TwoDeeShell:Clone()
- Clone.Rotation = Rot
- TwoDeeShells[Clone] = Data
- Clone.Parent = GUI
- if shockwave then
- Thread:Spawn(function()
- local ShockwaveClone = GUI.MagCartridge.UIGridLayout.Shockwave:Clone()
- local Degree = math.rad(math.random(360))
- ShockwaveClone.Position = UDim2.new(0, XCenter, 0, YCenter)
- ShockwaveClone.Rotation = math.deg(Degree)
- ShockwaveClone.Parent = GUI
- local Tween = TweenService:Create(ShockwaveClone, TweenInfo.new(0.25, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Size = UDim2.new(0, 50, 0, 50), ImageTransparency = 1})
- Tween:Play()
- Tween.Completed:Wait()
- ShockwaveClone:Destroy()
- end)
- end
- end
- end
- local function Fire(ShootingHandle, ShootingVMHandle, FireClientDirections, FireServerDirections)
- ViewmodelHandler:RecoilViewmodel(Module.ViewmodelRecoilInfluence)
- if Module.AimAnimationsEnabled and Variables.AimDown == true then
- if CurrentAimFireAnim then
- CurrentAimFireAnim:Play(nil, nil, CurrentAimFireAnimationSpeed)
- end
- else
- if CurrentFireAnim then
- CurrentFireAnim:Play(nil, nil, CurrentFireAnimationSpeed)
- end
- end
- if CurrentVMFireAnim then
- CurrentVMFireAnim:Play(nil, nil, CurrentVMFireAnimationSpeed)
- end
- if Animations.MinigunRevUpAnim and Animations.MinigunRevUpAnim.IsPlaying then
- Animations.MinigunRevUpAnim:Stop()
- end
- if VMAnimations.VMMinigunRevUpAnim and VMAnimations.VMMinigunRevUpAnim.IsPlaying then
- VMAnimations.VMMinigunRevUpAnim:Stop()
- end
- --[[if Animations.FireAnim then
- Animations.FireAnim:Play(nil, nil, Module.FireAnimationSpeed)
- end]]
- --[[if VMAnimations.VMFireAnim then
- VMAnimations.VMFireAnim:Play(nil, nil, Module.VMFireAnimationSpeed)
- end]]
- --[[if not ShootingHandle.FireSound.Playing or not ShootingHandle.FireSound.Looped then
- ShootingHandle.FireSound:Play()
- end]]
- local HitEffectFolder = VisualEffects.HitEffect
- local BloodEffectFolder = VisualEffects.BloodEffect
- local ExplosionEffectFolder = VisualEffects.ExplosionEffect
- if Module.ChargedShotAdvanceEnabled then
- if Variables.ChargeLevel == 1 then
- if VisualEffects:FindFirstChild("HitEffectLvl1") then
- HitEffectFolder = VisualEffects.HitEffectLvl1
- else
- HitEffectFolder = VisualEffects.HitEffect
- end
- if VisualEffects:FindFirstChild("BloodEffectLvl1") then
- BloodEffectFolder = VisualEffects.BloodEffectLvl1
- else
- BloodEffectFolder = VisualEffects.BloodEffect
- end
- if VisualEffects:FindFirstChild("ExplosionEffectLvl1") then
- ExplosionEffectFolder = VisualEffects.ExplosionEffectLvl1
- else
- ExplosionEffectFolder = VisualEffects.ExplosionEffect
- end
- elseif Variables.ChargeLevel == 2 then
- if VisualEffects:FindFirstChild("HitEffectLvl2") then
- HitEffectFolder = VisualEffects.HitEffectLvl2
- else
- HitEffectFolder = VisualEffects.HitEffect
- end
- if VisualEffects:FindFirstChild("BloodEffectLvl2") then
- BloodEffectFolder = VisualEffects.BloodEffectLvl2
- else
- BloodEffectFolder = VisualEffects.BloodEffect
- end
- if VisualEffects:FindFirstChild("ExplosionEffectLvl2") then
- ExplosionEffectFolder = VisualEffects.ExplosionEffectLvl2
- else
- ExplosionEffectFolder = VisualEffects.ExplosionEffect
- end
- elseif Variables.ChargeLevel == 3 then
- if VisualEffects:FindFirstChild("HitEffectLvl3") then
- HitEffectFolder = VisualEffects.HitEffectLvl3
- else
- HitEffectFolder = VisualEffects.HitEffect
- end
- if VisualEffects:FindFirstChild("BloodEffectLvl3") then
- BloodEffectFolder = VisualEffects.BloodEffectLvl3
- else
- BloodEffectFolder = VisualEffects.BloodEffect
- end
- if VisualEffects:FindFirstChild("ExplosionEffectLvl3") then
- ExplosionEffectFolder = VisualEffects.ExplosionEffectLvl3
- else
- ExplosionEffectFolder = VisualEffects.ExplosionEffect
- end
- end
- end
- ProjectileHandler:SimulateProjectile(Module,Tool,ShootingHandle,
- (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 and ShootingVMHandle or nil,
- FireClientDirections,
- FireServerDirections,
- ShootingHandle:FindFirstChild("GunFirePoint"),
- {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)},
- {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)}},
- {Module.BulletHoleEnabled,AddressTableValue(Module.ChargeAlterTable.BulletHoleSize, Module.BulletHoleSize),AddressTableValue(Module.ChargeAlterTable.BulletHoleTexture, Module.BulletHoleTexture),AddressTableValue(Module.ChargeAlterTable.PartColor, Module.PartColor),Module.BulletHoleVisibleTime,Module.BulletHoleFadeTime},
- {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)},
- {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},
- {Module.WhizSoundEnabled,Module.WhizSoundID,Module.WhizSoundPitchMin,Module.WhizSoundPitchMax,Module.WhizDistance,Module.WhizSoundVolume},
- {{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},
- {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)},
- {Module.CriticalDamageEnabled,AddressTableValue(Module.ChargeAlterTable.CriticalBaseChance, Module.CriticalBaseChance),AddressTableValue(Module.ChargeAlterTable.CriticalDamageMultiplier, Module.CriticalDamageMultiplier)},
- {Module.GoreEffectEnabled,Module.GoreSoundIDs,Module.GoreSoundPitchMin,Module.GoreSoundPitchMax,Module.GoreSoundVolume,VisualEffects.GoreEffect,Module.FullyGibbedLimbChance}})
- end
- local function Overheat()
- if Variables.ActuallyEquipped and Variables.Enabled and not Variables.Overheated and (Variables.Ammo > 0 or not Module.LimitedAmmoEnabled) and Variables.Heat >= Module.MaxHeat then
- Variables.Overheated = true
- if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
- Animations.InspectAnim:Stop()
- end
- if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
- VMAnimations.VMInspectAnim:Stop()
- end
- if Variables.AimDown then
- TweenService:Create(Camera, TweenInfo.new(Module.TweenLengthNAD, Module.EasingStyleNAD, Module.EasingDirectionNAD), {FieldOfView = 70}):Play()
- SetCrossScale(1)
- if Module.AimAnimationsEnabled and Animations.AimIdleAnim and Animations.AimIdleAnim.IsPlaying then
- Animations.AimIdleAnim:Stop()
- if Animations.IdleAnim then
- Animations.IdleAnim:Play(nil, nil, Module.IdleAnimationSpeed)
- end
- end
- if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
- Viewmodel.isAiming.Value = false
- end
- Variables.Scoping = false
- Player.CameraMode = Enum.CameraMode.Classic
- UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity
- Variables.AimDown = false
- end
- UpdateGUI()
- if Variables.ActuallyEquipped then
- if Animations.OverheatAnim then
- Animations.OverheatAnim:Play(nil, nil, Module.OverheatAnimationSpeed)
- end
- if VMAnimations.VMOverheatAnim then
- VMAnimations.VMOverheatAnim:Play(nil, nil, Module.VMOverheatAnimationSpeed)
- end
- Handle.OverheatSound:Play()
- end
- --Thread:Wait(Module.OverheatTime)
- for i = 1, Module.MaxHeat do
- Thread:Wait(Module.OverheatTime / Module.MaxHeat)
- Variables.Heat = Variables.Heat - 1
- UpdateGUI()
- if Variables.Heat == 0 then
- Variables.Overheated = false
- break
- end
- end
- Variables.Overheated = false
- UpdateGUI()
- end
- end
- local function Reload()
- if Variables.ActuallyEquipped and Variables.Enabled and not Variables.Reloading and (Variables.Ammo > 0 or not Module.LimitedAmmoEnabled) and Variables.Mag < Module.AmmoPerMag then
- Variables.Reloading = true
- if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
- Animations.InspectAnim:Stop()
- end
- if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
- VMAnimations.VMInspectAnim:Stop()
- end
- if Variables.AimDown then
- TweenService:Create(Camera, TweenInfo.new(Module.TweenLengthNAD, Module.EasingStyleNAD, Module.EasingDirectionNAD), {FieldOfView = 70}):Play()
- SetCrossScale(1)
- if Module.AimAnimationsEnabled and Animations.AimIdleAnim and Animations.AimIdleAnim.IsPlaying then
- Animations.AimIdleAnim:Stop()
- if Animations.IdleAnim then
- Animations.IdleAnim:Play(nil, nil, Module.IdleAnimationSpeed)
- end
- end
- if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
- Viewmodel.isAiming.Value = false
- end
- Variables.Scoping = false
- Player.CameraMode = Enum.CameraMode.Classic
- UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity
- Variables.AimDown = false
- end
- UpdateGUI()
- if Module.ShotgunReload then
- if Module.PreShotgunReload then
- if Variables.ActuallyEquipped then
- if Animations.PreShotgunReloadAnim then
- Animations.PreShotgunReloadAnim:Play(nil, nil, Module.PreShotgunReloadAnimationSpeed)
- end
- if VMAnimations.VMPreShotgunReloadAnim then
- VMAnimations.VMPreShotgunReloadAnim:Play(nil, nil, Module.VMPreShotgunReloadAnimationSpeed)
- end
- Handle.PreReloadSound:Play()
- end
- local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.PreShotgunReloadSpeed
- --Thread:Wait(Module.PreShotgunReloadSpeed)
- end
- for i = 1, (Module.AmmoPerMag - Variables.Mag) do
- if Variables.ActuallyEquipped then
- if Animations.ShotgunClipinAnim then
- Animations.ShotgunClipinAnim:Play(nil, nil, Module.ShotgunClipinAnimationSpeed)
- end
- if VMAnimations.VMShotgunClipinAnim then
- VMAnimations.VMShotgunClipinAnim:Play(nil, nil, Module.VMShotgunClipinAnimationSpeed)
- end
- Handle.ShotgunClipin:Play()
- end
- local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.ShellClipinSpeed
- --Thread:Wait(Module.ShellClipinSpeed)
- if Variables.Mag < Module.AmmoPerMag then
- if Variables.ActuallyEquipped then
- if Module.LimitedAmmoEnabled then
- if Variables.Ammo > 0 then
- Variables.Mag = Variables.Mag + 1
- Variables.Ammo = Variables.Ammo - 1
- ChangeMagAndAmmo:FireServer(Variables.Mag, Variables.Ammo, Variables.Heat)
- if Module.MagCartridge and not Module.BatteryEnabled then
- for i = 1, Variables.Mag do
- GUI.MagCartridge[i].Visible = true
- end
- end
- UpdateGUI()
- end
- else
- Variables.Mag = Variables.Mag + 1
- Variables.Ammo = Variables.Ammo - 1
- ChangeMagAndAmmo:FireServer(Variables.Mag, Variables.Ammo, Variables.Heat)
- if Module.MagCartridge and not Module.BatteryEnabled then
- for i = 1, Variables.Mag do
- GUI.MagCartridge[i].Visible = true
- end
- end
- UpdateGUI()
- end
- end
- else
- break
- end
- if Module.LimitedAmmoEnabled then
- if (not Variables.ActuallyEquipped) or (Variables.Ammo <= 0) then
- break
- end
- else
- if (not Variables.ActuallyEquipped) then
- break
- end
- end
- end
- end
- if Variables.ActuallyEquipped then
- if Module.TacticalReloadAnimationEnabled then
- if Variables.Mag > 0 then
- if Animations.TacticalReloadAnim then
- Animations.TacticalReloadAnim:Play(nil, nil, Module.TacticalReloadAnimationSpeed)
- end
- if VMAnimations.VMTacticalReloadAnim then
- VMAnimations.VMTacticalReloadAnim:Play(nil, nil, Module.VMTacticalReloadAnimationSpeed)
- end
- Handle.TacticalReloadSound:Play()
- else
- if Animations.ReloadAnim then
- Animations.ReloadAnim:Play(nil, nil, Module.ReloadAnimationSpeed)
- end
- if VMAnimations.VMReloadAnim then
- VMAnimations.VMReloadAnim:Play(nil,nil,Module.VMReloadAnimationSpeed)
- end
- VMAnimations.VMReloadAnim:GetMarkerReachedSignal("MagOut"):Connect(function()
- Handle.MagOut:Play()
- end)
- VMAnimations.VMReloadAnim:GetMarkerReachedSignal("MagIn"):Connect(function()
- Handle.MagIn:Play()
- end)
- VMAnimations.VMReloadAnim:GetMarkerReachedSignal("SlideBack"):Connect(function()
- Handle.SlideBack:Play()
- end)
- end
- else
- if Animations.ReloadAnim then
- Animations.ReloadAnim:Play(nil, nil, Module.ReloadAnimationSpeed)
- end
- if VMAnimations.VMReloadAnim then
- VMAnimations.VMReloadAnim:Play(nil,nil,Module.VMReloadAnimationSpeed)
- end
- VMAnimations.VMReloadAnim:GetMarkerReachedSignal("MagOut"):Connect(function()
- Handle.MagOut:Play()
- end)
- VMAnimations.VMReloadAnim:GetMarkerReachedSignal("MagIn"):Connect(function()
- Handle.MagIn:Play()
- end)
- VMAnimations.VMReloadAnim:GetMarkerReachedSignal("SlideBack"):Connect(function()
- Handle.SlideBack:Play()
- end)
- end
- end
- local ReloadTime = (Variables.Mag > 0 and Module.TacticalReloadAnimationEnabled) and Module.TacticalReloadTime or Module.ReloadTime
- local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= ReloadTime
- --Thread:Wait((Variables.Mag > 0 and Module.TacticalReloadAnimationEnabled) and Module.TacticalReloadTime or Module.ReloadTime)
- if Variables.ActuallyEquipped then
- if not Module.ShotgunReload then
- if Module.MagCartridge and Module.DropAllRemainingBullets and not Module.BatteryEnabled then
- for i = 1, Variables.Mag do
- local Bullet = GUI.MagCartridge:FindFirstChild(i)
- local Vel = Random2DDirection(Module.DropVelocity, math.random(Module.DropXMin, Module.DropXMax), math.random(Module.DropYMin, Module.DropYMax)) * (math.random() ^ 0.5)
- CreateTwoDeeShell(Bullet.Rotation, Bullet.AbsolutePosition, Bullet.AbsoluteSize, Vel, "bullet")
- end
- end
- if Module.LimitedAmmoEnabled then
- local ammoToUse = math.min(Module.AmmoPerMag - Variables.Mag, Variables.Ammo)
- Variables.Mag = Variables.Mag + ammoToUse
- Variables.Ammo = Variables.Ammo - ammoToUse
- else
- Variables.Mag = Module.AmmoPerMag
- end
- ChangeMagAndAmmo:FireServer(Variables.Mag, Variables.Ammo, Variables.Heat)
- end
- end
- Variables.Reloading = false
- if Module.MagCartridge and not Module.BatteryEnabled then
- for i = 1, Variables.Mag do
- GUI.MagCartridge[i].Visible = true
- end
- end
- UpdateGUI()
- end
- end
- local function OnTooglingAiming()
- 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
- if not Module.KeepAimingOnReloading then
- if Variables.Reloading or Variables.Overheated then
- return
- end
- end
- TweenService:Create(Camera, TweenInfo.new(Module.TweenLength, Module.EasingStyle, Module.EasingDirection), {FieldOfView = Module.FieldOfViewIS}):Play()
- SetCrossScale(Module.CrossScaleIS)
- if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
- Animations.InspectAnim:Stop()
- end
- if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
- VMAnimations.VMInspectAnim:Stop()
- end
- if Module.AimAnimationsEnabled and Animations.IdleAnim and Animations.IdleAnim.IsPlaying then
- Animations.IdleAnim:Stop()
- if Animations.AimIdleAnim then
- Animations.AimIdleAnim:Play(nil, nil, Module.AimIdleAnimationSpeed)
- end
- end
- if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
- Viewmodel.isAiming.Value = true
- end
- Player.CameraMode = Enum.CameraMode.LockFirstPerson
- UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity * Module.MouseSensitiveIS
- Variables.AimDown = true
- 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
- if not Module.KeepAimingOnReloading then
- if Variables.Reloading or Variables.Overheated then
- return
- end
- end
- TweenService:Create(Camera, TweenInfo.new(Module.TweenLength, Module.EasingStyle, Module.EasingDirection), {FieldOfView = Module.FieldOfViewS}):Play()
- SetCrossScale(Module.CrossScaleS)
- if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
- Animations.InspectAnim:Stop()
- end
- if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
- VMAnimations.VMInspectAnim:Stop()
- end
- if Module.AimAnimationsEnabled and Animations.IdleAnim and Animations.IdleAnim.IsPlaying then
- Animations.IdleAnim:Stop()
- if Animations.AimIdleAnim then
- Animations.AimIdleAnim:Play(nil, nil, Module.AimIdleAnimationSpeed)
- end
- end
- if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
- Viewmodel.isAiming.Value = true
- end
- Variables.AimDown = true
- local StartTime = os.clock() repeat Thread:Wait() if not (Variables.ActuallyEquipped or Variables.AimDown) then break end until (os.clock() - StartTime) >= Module.ScopeDelay
- if Variables.ActuallyEquipped and Variables.AimDown then
- local ZoomSound = GUI.Scope.ZoomSound:Clone()
- ZoomSound.Parent = Player.PlayerGui
- ZoomSound:Play()
- ZoomSound.Ended:Connect(function()
- ZoomSound:Destroy()
- end)
- Player.CameraMode = Enum.CameraMode.LockFirstPerson
- UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity * Module.MouseSensitiveS
- Variables.Scoping = true
- end
- else
- TweenService:Create(Camera, TweenInfo.new(Module.TweenLengthNAD, Module.EasingStyleNAD, Module.EasingDirectionNAD), {FieldOfView = 70}):Play()
- SetCrossScale(1)
- if Module.AimAnimationsEnabled and Animations.AimIdleAnim and Animations.AimIdleAnim.IsPlaying then
- Animations.AimIdleAnim:Stop()
- if Animations.IdleAnim then
- Animations.IdleAnim:Play(nil, nil, Module.IdleAnimationSpeed)
- end
- end
- if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
- Viewmodel.isAiming.Value = false
- end
- Variables.Scoping = false
- Player.CameraMode = Enum.CameraMode.Classic
- UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity
- Variables.AimDown = false
- end
- end
- local function OnHoldingDown()
- if Module.HoldDownEnabled then
- if not Variables.Reloading and not Variables.Overheated and Variables.ActuallyEquipped and Variables.Enabled then
- if not Variables.HoldDown then
- Variables.HoldDown = true
- if Animations.AimIdleAnim and Animations.AimIdleAnim.IsPlaying then
- Animations.AimIdleAnim:Stop()
- end
- if Animations.IdleAnim and Animations.IdleAnim.IsPlaying then
- Animations.IdleAnim:Stop()
- end
- if VMAnimations.VMIdleAnim and VMAnimations.VMIdleAnim.IsPlaying then
- VMAnimations.VMIdleAnim:Stop()
- end
- if Animations.HoldDownAnim then
- Animations.HoldDownAnim:Play(nil, nil, Module.HoldDownAnimationSpeed)
- end
- if VMAnimations.VMHoldDownAnim then
- VMAnimations.VMHoldDownAnim:Play(nil, nil, Module.VMHoldDownAnimationSpeed)
- end
- if Variables.AimDown then
- TweenService:Create(Camera, TweenInfo.new(Module.TweenLengthNAD, Module.EasingStyleNAD, Module.EasingDirectionNAD), {FieldOfView = 70}):Play()
- SetCrossScale(1)
- if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
- Viewmodel.isAiming.Value = false
- end
- Variables.Scoping = false
- Player.CameraMode = Enum.CameraMode.Classic
- UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity
- Variables.AimDown = false
- end
- else
- Variables.HoldDown = false
- if Animations.IdleAnim then
- Animations.IdleAnim:Play(nil, nil, Module.IdleAnimationSpeed)
- end
- if VMAnimations.VMIdleAnim then
- VMAnimations.VMIdleAnim:Play(nil, nil, Module.VMIdleAnimationSpeed)
- end
- if Animations.HoldDownAnim and Animations.HoldDownAnim.IsPlaying then
- Animations.HoldDownAnim:Stop()
- end
- if VMAnimations.VMHoldDownAnim and VMAnimations.VMHoldDownAnim.IsPlaying then
- VMAnimations.VMHoldDownAnim:Stop()
- end
- end
- end
- end
- end
- local function OnInspecting()
- 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
- Variables.Inspecting = true
- if Animations.InspectAnim then
- Animations.InspectAnim:Play(nil, nil, Module.InspectAnimationSpeed)
- end
- if VMAnimations.VMInspectAnim then
- VMAnimations.VMInspectAnim:Play(nil, nil, Module.VMInspectAnimationSpeed)
- end
- 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
- Variables.Inspecting = false
- end
- end
- local function OnSwitching()
- 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
- Variables.Switching = true
- if Animations.SwitchAnim then
- Animations.SwitchAnim:Play(nil,nil,Module.SwitchAnimationSpeed)
- end
- if VMAnimations.VMSwitchAnim and not VMAnimations.VMSwitchAnim.IsPlaying then
- VMAnimations.VMSwitchAnim:Play(nil, nil, Module.VMSwitchAnimationSpeed)
- end
- 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
- Variables.Switching = false
- if Variables.ActuallyEquipped and not Variables.Reloading and not Variables.Overheated and Variables.Enabled and not Variables.Inspecting then
- Handle.SwitchSound:Play()
- Variables.FireMode = Variables.FireMode % #Variables.FireModes + 1
- UpdateGUI()
- end
- end
- end
- local function OnFiring()
- if Module.ChargedShotAdvanceEnabled and not Module.SelectiveFireEnabled then
- Variables.Charging = true
- 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
- Variables.CanBeCooledDown = false
- Variables.Enabled = false
- if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
- Animations.InspectAnim:Stop()
- end
- if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
- VMAnimations.VMInspectAnim:Stop()
- end
- if Module.AimAnimationsEnabled and Variables.AimDown == true then
- if Animations.AimChargingAnim and not Animations.AimChargingAnim.IsPlaying then
- Animations.AimChargingAnim:Play(nil, nil, Module.AimChargingAnimationSpeed)
- end
- else
- if Animations.ChargingAnim and not Animations.ChargingAnim.IsPlaying then
- Animations.ChargingAnim:Play(nil, nil, Module.ChargingAnimationSpeed)
- end
- end
- if VMAnimations.VMChargingAnim and not VMAnimations.VMChargingAnim.IsPlaying then
- VMAnimations.VMChargingAnim:Play(nil, nil, Module.VMChargingAnimationSpeed)
- end
- local ChargingSound = HandleToFire:FindFirstChild("ChargingSound")
- local StartTime = os.clock()
- while true do
- local DeltaTime = os.clock() - StartTime
- if Variables.ChargeLevel == 0 and DeltaTime >= Module.Level1ChargingTime then
- Variables.ChargeLevel = 1
- GUI.ChargeBar.ChargeLevel1:Play()
- elseif Variables.ChargeLevel == 1 and DeltaTime >= Module.Level2ChargingTime then
- Variables.ChargeLevel = 2
- GUI.ChargeBar.ChargeLevel2:Play()
- elseif Variables.ChargeLevel == 2 and DeltaTime >= Module.AdvancedChargingTime then
- Variables.ChargeLevel = 3
- GUI.ChargeBar.ChargeLevel3:Play()
- GUI.ChargeBar.Shine.UIGradient.Offset = Vector2.new(-1, 0)
- TweenService:Create(GUI.ChargeBar.Shine.UIGradient, TweenInfo.new(0.5, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {Offset = Vector2.new(1, 0)}):Play()
- end
- local ChargePercent = math.min(DeltaTime / Module.AdvancedChargingTime, 1)
- if ChargePercent < 0.5 then --Fade from red to yellow then to green
- GUI.ChargeBar.Fill.BackgroundColor3 = Color3.new(1, ChargePercent * 2, 0)
- else
- GUI.ChargeBar.Fill.BackgroundColor3 = Color3.new(1 - ((ChargePercent - 0.5) / 0.5), 1, 0)
- end
- GUI.ChargeBar.Fill.Size = UDim2.new(ChargePercent, 0, 1, 0)
- if ChargingSound then
- if not ChargingSound.Playing then
- ChargingSound:Play()
- end
- if Module.ChargingSoundIncreasePitch then
- ChargingSound.PlaybackSpeed = Module.ChargingSoundPitchRange[1] + (ChargePercent * (Module.ChargingSoundPitchRange[2] - Module.ChargingSoundPitchRange[1]))
- end
- end
- Thread:Wait()
- if Variables.ActuallyEquipped == false or Variables.Charging == false then
- break
- end
- end
- if Animations.AimChargingAnim and Animations.AimChargingAnim.IsPlaying then
- Animations.AimChargingAnim:Stop(0)
- end
- if Animations.ChargingAnim and Animations.ChargingAnim.IsPlaying then
- Animations.ChargingAnim:Stop(0)
- end
- if VMAnimations.VMChargingAnim and VMAnimations.VMChargingAnim.IsPlaying then
- VMAnimations.VMChargingAnim:Stop(0)
- end
- GUI.ChargeBar.Fill.Size = UDim2.new(0, 0, 1, 0)
- if ChargingSound then
- if ChargingSound.Playing then
- ChargingSound:Stop()
- end
- if Module.ChargingSoundIncreasePitch then
- ChargingSound.PlaybackSpeed = Module.ChargingSoundPitchRange[1]
- end
- end
- if not Variables.ActuallyEquipped then
- Variables.ChargeLevel = 0
- Variables.Enabled = true
- end
- 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
- for i = 1, (Module.BurstFireEnabled and (AddressTableValue(Module.ChargeAlterTable.BulletPerBurst, Module.BulletPerBurst)) or 1) do
- if not Variables.ActuallyEquipped then
- break
- end
- Variables.ShotID = Variables.ShotID + 1
- local LastShotID = Variables.ShotID
- local CLDirections = {}
- local SVDirections = {}
- --VVV Edit here VVV--
- --Knockback.t = 1 * Vector3.new(-1, -20 * 0.005, 0)
- --^^^ Edit here ^^^--
- Thread:Spawn(RecoilCamera)
- CrossSpring:Accelerate(AddressTableValue(Module.ChargeAlterTable.CrossExpansion, Module.CrossExpansion))
- if not Module.ShotgunPump then
- Thread:Spawn(function()
- local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.BulletShellDelay
- if Variables.ActuallyEquipped then
- EjectShell(((Camera.Focus.p-Camera.CoordinateFrame.p).magnitude <= 1) and VMHandleToFire or HandleToFire)
- end
- end)
- end
- local SoundFolder = HandleToFire.FireSounds
- if Variables.ChargeLevel == 1 then
- if HandleToFire:FindFirstChild("FireSoundsLvl1") then
- SoundFolder = HandleToFire.FireSoundsLvl1
- else
- SoundFolder = HandleToFire.FireSounds
- end
- elseif Variables.ChargeLevel == 2 then
- if HandleToFire:FindFirstChild("FireSoundsLvl2") then
- SoundFolder = HandleToFire.FireSoundsLvl2
- else
- SoundFolder = HandleToFire.FireSounds
- end
- elseif Variables.ChargeLevel == 3 then
- if HandleToFire:FindFirstChild("FireSoundsLvl3") then
- SoundFolder = HandleToFire.FireSoundsLvl3
- else
- SoundFolder = HandleToFire.FireSounds
- end
- end
- local Tracks = SoundFolder:GetChildren()
- local Chosen = math.random(1, #Tracks)
- local Track = Tracks[Chosen]
- if Track ~= nil then
- AudioHandler:PlayAudio({
- SoundId = Track.SoundId,
- EmitterSize = Track.EmitterSize,
- MaxDistance = Track.MaxDistance,
- Volume = Track.Volume,
- Pitch = Track.PlaybackSpeed,
- Origin = HandleToFire:FindFirstChild("GunMuzzlePoint"),
- Echo = Module.EchoEffect,
- Silenced = Module.SilenceEffect
- },
- {
- Enabled = Module.LowAmmo,
- CurrentAmmo = Variables.Mag,
- AmmoPerMag = Module.AmmoPerMag,
- SoundId = HandleToFire.LowAmmoSound.SoundId,
- EmitterSize = HandleToFire.LowAmmoSound.EmitterSize,
- MaxDistance = HandleToFire.LowAmmoSound.MaxDistance,
- Volume = HandleToFire.LowAmmoSound.Volume,
- Pitch = Module.RaisePitch and (math.max(math.abs(Variables.Mag / 10 - 1), 0.4)) or HandleToFire.LowAmmoSound.PlaybackSpeed,
- Origin = HandleToFire:FindFirstChild("GunMuzzlePoint")
- }, true)
- end
- local MuzzleFolder = VisualEffects.MuzzleEffect
- if Variables.ChargeLevel == 1 then
- if VisualEffects:FindFirstChild("MuzzleEffectLvl1") then
- MuzzleFolder = VisualEffects.MuzzleEffectLvl1
- else
- MuzzleFolder = VisualEffects.MuzzleEffect
- end
- elseif Variables.ChargeLevel == 2 then
- if VisualEffects:FindFirstChild("MuzzleEffectLvl2") then
- MuzzleFolder = VisualEffects.MuzzleEffectLvl2
- else
- MuzzleFolder = VisualEffects.MuzzleEffect
- end
- elseif Variables.ChargeLevel == 3 then
- if VisualEffects:FindFirstChild("MuzzleEffectLvl3") then
- MuzzleFolder = VisualEffects.MuzzleEffectLvl3
- else
- MuzzleFolder = VisualEffects.MuzzleEffect
- end
- end
- MuzzleHandler:VisualizeMuzzle(HandleToFire,
- (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 and VMHandleToFire or nil,
- Module.MuzzleFlashEnabled,
- {Module.MuzzleLightEnabled,AddressTableValue(Module.ChargeAlterTable.LightBrightness, Module.LightBrightness),AddressTableValue(Module.ChargeAlterTable.LightColor, Module.LightColor),AddressTableValue(Module.ChargeAlterTable.LightRange, Module.LightRange),Module.LightShadows,Module.VisibleTime},
- MuzzleFolder,
- true)
- Variables.CurrentRate = Variables.CurrentRate + Module.SmokeTrailRateIncrement
- for ii = 1, (Module.ShotgunEnabled and (AddressTableValue(Module.ChargeAlterTable.BulletPerShot, Module.BulletPerShot)) or 1) do
- local Position = Get3DPosition(GUI.Crosshair.AbsolutePosition)
- local Spread = AddressTableValue(Module.ChargeAlterTable.Spread, Module.Spread)
- local CurrentSpread = Spread * 10 * (Variables.AimDown and 1 - Module.SpreadRedutionIS and 1 - Module.SpreadRedutionS or 1)
- 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)
- local svCframe = CFrame.new(HandleToFire:FindFirstChild("GunFirePoint").WorldPosition, Position)
- local X, Y = Module.SpreadPattern[ii][1], Module.SpreadPattern[ii][2]
- local SpreadPattern = CFrame.Angles(math.rad(CurrentSpread * Y / 50), math.rad(CurrentSpread * X / 50), 0)
- local SpreadNormal = CFrame.Angles(math.rad(math.random(-CurrentSpread, CurrentSpread) / 50), math.rad(math.random(-CurrentSpread, CurrentSpread) / 50), 0)
- if Module.ShotgunPattern and Module.SpreadPattern then
- cframe = cframe * SpreadPattern
- svCframe = svCframe * SpreadPattern
- else
- cframe = cframe * SpreadNormal
- svCframe = svCframe * SpreadNormal
- end
- local ClDirection = cframe.LookVector
- local SvDirection = svCframe.LookVector
- table.insert(CLDirections, ClDirection)
- table.insert(SVDirections, SvDirection)
- end
- if AddressTableValue(Module.ChargeAlterTable.SelfKnockback, Module.SelfKnockback) then
- local KnockbackPosition = Get3DPosition(GUI.Crosshair.AbsolutePosition)
- SelfKnockback(KnockbackPosition, Torso.Position)
- end
- Fire(HandleToFire, VMHandleToFire, CLDirections, SVDirections)
- if Module.BatteryEnabled then
- Variables.ShotsForDepletion = Variables.ShotsForDepletion + 1
- if Variables.ShotsForDepletion >= Module.ShotsForDepletion then
- Variables.ShotsForDepletion = 0
- Variables.Ammo = Variables.Ammo - Random.new():NextInteger(AddressTableValue(Module.ChargeAlterTable.MinDepletion, Module.MinDepletion), AddressTableValue(Module.ChargeAlterTable.MaxDepletion, Module.MaxDepletion))
- end
- Variables.Heat = Variables.Heat + Random.new():NextInteger(AddressTableValue(Module.ChargeAlterTable.HeatPerFireMin, Module.HeatPerFireMin), AddressTableValue(Module.ChargeAlterTable.HeatPerFireMax, Module.HeatPerFireMax))
- else
- if Module.MagCartridge and not Module.BatteryEnabled and Module.AmmoPerMag ~= math.huge then
- local Bullet = GUI.MagCartridge:FindFirstChild(Variables.Mag)
- if Module.Ejection then
- local Vel = Random2DDirection(Module.Velocity, math.random(Module.XMin, Module.XMax), math.random(Module.YMin, Module.YMax)) * (math.random() ^ 0.5)
- CreateTwoDeeShell(Bullet.Rotation, Bullet.AbsolutePosition, Bullet.AbsoluteSize, Vel, "shell", Module.Shockwave)
- end
- Bullet.Visible = false
- end
- Variables.Mag = Variables.Mag - 1
- end
- ChangeMagAndAmmo:FireServer(Variables.Mag, Variables.Ammo, Variables.Heat)
- Thread:Spawn(function()
- local Interrupted = false
- local StartTime = os.clock() repeat Thread:Wait() if LastShotID ~= Variables.ShotID then break end until (os.clock() - StartTime) >= Module.TimeBeforeCooldown
- if LastShotID ~= Variables.ShotID then Interrupted = true end
- if not Interrupted then
- Variables.CanBeCooledDown = true
- end
- end)
- UpdateGUI()
- if Module.BurstFireEnabled then
- local BurstRate = AddressTableValue(Module.ChargeAlterTable.BurstRate, Module.BurstRate)
- local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= BurstRate
- --Thread:Wait(Module.BurstRate)
- end
- --[[if not Variables.ActuallyEquipped then
- break
- end]]
- if Module.BatteryEnabled then
- if Variables.Heat >= Module.MaxHeat then
- break
- end
- else
- if Variables.Mag <= 0 then
- break
- end
- end
- end
- if not Module.ShotgunPump then
- HandleToFire = (HandleToFire == Handle and Module.DualEnabled) and Handle2 or Handle
- VMHandleCounts = (VMHandleCounts == 1 and Module.DualEnabled) and 2 or 1
- VMHandleToFire = VMHandleCounts == 1 and VMHandle or VMHandle2
- if Module.AimAnimationsEnabled then
- CurrentAimFireAnim = (CurrentAimFireAnim == Animations.AimFireAnim and Module.SecondaryFireAnimationEnabled) and Animations.AimSecondaryFireAnim or Animations.AimFireAnim
- CurrentAimFireAnimationSpeed = (CurrentAimFireAnimationSpeed == Module.AimFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.AimSecondaryFireAnimationSpeed or Module.AimFireAnimationSpeed
- end
- CurrentFireAnim = (CurrentFireAnim == Animations.FireAnim and Module.SecondaryFireAnimationEnabled) and Animations.SecondaryFireAnim or Animations.FireAnim
- CurrentFireAnimationSpeed = (CurrentFireAnimationSpeed == Module.FireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.SecondaryFireAnimationSpeed or Module.FireAnimationSpeed
- CurrentVMFireAnim = (CurrentVMFireAnim == VMAnimations.VMFireAnim and Module.SecondaryFireAnimationEnabled) and VMAnimations.VMSecondaryFireAnim or VMAnimations.VMFireAnim
- CurrentVMFireAnimationSpeed = (CurrentVMFireAnimationSpeed == Module.VMFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.VMSecondaryFireAnimationSpeed or Module.VMFireAnimationSpeed
- end
- Thread:Wait(AddressTableValue(Module.ChargeAlterTable.FireRate, Module.FireRate))
- if (Module.BatteryEnabled and Variables.Heat >= Module.MaxHeat or Variables.Mag <= 0) then
- if Variables.CurrentRate >= Module.MaximumRate and Module.SmokeTrailEnabled then
- Thread:Spawn(function()
- SmokeTrail:StopEmission()
- SmokeTrail:EmitSmokeTrail(HandleToFire.SmokeTrail, VMHandleToFire.SmokeTrail, Module.MaximumTime)
- end)
- end
- end
- if Module.ShotgunPump then
- if Variables.ActuallyEquipped then
- if CurrentShotgunPumpinAnim then
- CurrentShotgunPumpinAnim:Play(nil, nil, CurrentShotgunPumpinAnimationSpeed)
- end
- if CurrentVMShotgunPumpinAnim then
- CurrentVMShotgunPumpinAnim:Play(nil, nil, CurrentVMShotgunPumpinAnimationSpeed)
- end
- if HandleToFire:FindFirstChild("PumpSound") then
- HandleToFire.PumpSound:Play()
- end
- Thread:Spawn(function()
- local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.BulletShellDelay
- if Variables.ActuallyEquipped then
- EjectShell(((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1) and VMHandleToFire or HandleToFire)
- end
- end)
- end
- HandleToFire = (HandleToFire == Handle and Module.DualEnabled) and Handle2 or Handle
- VMHandleCounts = (VMHandleCounts == 1 and Module.DualEnabled) and 2 or 1
- VMHandleToFire = VMHandleCounts == 1 and VMHandle or VMHandle2
- if Module.AimAnimationsEnabled then
- CurrentAimFireAnim = (CurrentAimFireAnim == Animations.AimFireAnim and Module.SecondaryFireAnimationEnabled) and Animations.AimSecondaryFireAnim or Animations.AimFireAnim
- CurrentAimFireAnimationSpeed = (CurrentAimFireAnimationSpeed == Module.AimFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.AimSecondaryFireAnimationSpeed or Module.AimFireAnimationSpeed
- end
- CurrentFireAnim = (CurrentFireAnim == Animations.FireAnim and Module.SecondaryFireAnimationEnabled) and Animations.SecondaryFireAnim or Animations.FireAnim
- CurrentFireAnimationSpeed = (CurrentFireAnimationSpeed == Module.FireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.SecondaryFireAnimationSpeed or Module.FireAnimationSpeed
- CurrentVMFireAnim = (CurrentVMFireAnim == VMAnimations.MFireAnim and Module.SecondaryFireAnimationEnabled) and VMAnimations.VMSecondaryFireAnim or VMAnimations.VMFireAnim
- CurrentVMFireAnimationSpeed = (CurrentVMFireAnimationSpeed == Module.VMFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.VMSecondaryFireAnimationSpeed or Module.VMFireAnimationSpeed
- CurrentShotgunPumpinAnim = (CurrentShotgunPumpinAnim == Animations.ShotgunPumpinAnim and Module.SecondaryShotgunPump) and Animations.SecondaryShotgunPumpinAnim or Animations.ShotgunPumpinAnim
- CurrentShotgunPumpinAnimationSpeed = (CurrentShotgunPumpinAnimationSpeed == Module.ShotgunPumpinAnimationSpeed and Module.SecondaryShotgunPump) and Module.SecondaryShotgunPumpinAnimationSpeed or Module.ShotgunPumpinAnimationSpeed
- CurrentVMShotgunPumpinAnim = (CurrentVMShotgunPumpinAnim == VMAnimations.VMShotgunPumpinAnim and Module.SecondaryShotgunPump) and VMAnimations.VMSecondaryShotgunPumpinAnim or VMAnimations.VMShotgunPumpinAnim
- CurrentVMShotgunPumpinAnimationSpeed = (CurrentVMShotgunPumpinAnimationSpeed == Module.VMShotgunPumpinAnimationSpeed and Module.SecondaryShotgunPump) and Module.VMSecondaryShotgunPumpinAnimationSpeed or Module.VMShotgunPumpinAnimationSpeed
- Thread:Wait(Module.ShotgunPumpinSpeed)
- end
- Variables.ChargeLevel = 0
- Variables.Enabled = true
- if Variables.ActuallyEquipped then
- if Module.BatteryEnabled then
- if Variables.Heat >= Module.MaxHeat then Overheat() end
- else
- if Module.AutoReload then
- if Variables.Mag <= 0 then Reload() end
- end
- end
- end
- end
- end
- elseif Module.HoldAndReleaseEnabled and not Module.SelectiveFireEnabled then
- Variables.Charging = true
- 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
- Variables.CanBeCooledDown = false
- Variables.Enabled = false
- if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
- Animations.InspectAnim:Stop()
- end
- if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
- VMAnimations.VMInspectAnim:Stop()
- end
- if Module.AimAnimationsEnabled and Variables.AimDown == true then
- if Animations.AimChargingAnim and not Animations.AimChargingAnim.IsPlaying then
- Animations.AimChargingAnim:Play(nil, nil, Module.AimChargingAnimationSpeed)
- end
- else
- if Animations.ChargingAnim and not Animations.ChargingAnim.IsPlaying then
- Animations.ChargingAnim:Play(nil, nil, Module.ChargingAnimationSpeed)
- end
- end
- if VMAnimations.VMChargingAnim and not VMAnimations.VMChargingAnim.IsPlaying then
- VMAnimations.VMChargingAnim:Play(nil, nil, Module.VMChargingAnimationSpeed)
- end
- local ChargingSound = HandleToFire:FindFirstChild("ChargingSound")
- local StartTime = os.clock()
- while true do
- local DeltaTime = os.clock() - StartTime
- if not Variables.Charged and DeltaTime >= Module.HoldingTime then
- Variables.Charged = true
- GUI.ChargeBar.ChargeLevel3:Play()
- GUI.ChargeBar.Shine.UIGradient.Offset = Vector2.new(-1, 0)
- TweenService:Create(GUI.ChargeBar.Shine.UIGradient, TweenInfo.new(0.5, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {Offset = Vector2.new(1, 0)}):Play()
- end
- local ChargePercent = math.min(DeltaTime / Module.HoldingTime, 1)
- if ChargePercent < 0.5 then --Fade from red to yellow then to green
- GUI.ChargeBar.Fill.BackgroundColor3 = Color3.new(1, ChargePercent * 2, 0)
- else
- GUI.ChargeBar.Fill.BackgroundColor3 = Color3.new(1 - ((ChargePercent - 0.5) / 0.5), 1, 0)
- end
- GUI.ChargeBar.Fill.Size = UDim2.new(ChargePercent, 0, 1, 0)
- if ChargingSound then
- if not ChargingSound.Playing then
- ChargingSound:Play()
- end
- if Module.ChargingSoundIncreasePitch then
- ChargingSound.PlaybackSpeed = Module.ChargingSoundPitchRange[1] + (ChargePercent * (Module.ChargingSoundPitchRange[2] - Module.ChargingSoundPitchRange[1]))
- end
- end
- Thread:Wait()
- if Variables.ActuallyEquipped == false or Variables.Charging == false then
- break
- end
- end
- if Animations.AimChargingAnim and Animations.AimChargingAnim.IsPlaying then
- Animations.AimChargingAnim:Stop(0)
- end
- if Animations.ChargingAnim and Animations.ChargingAnim.IsPlaying then
- Animations.ChargingAnim:Stop(0)
- end
- if VMAnimations.VMChargingAnim and VMAnimations.VMChargingAnim.IsPlaying then
- VMAnimations.VMChargingAnim:Stop(0)
- end
- GUI.ChargeBar.Fill.Size = UDim2.new(0, 0, 1, 0)
- if ChargingSound then
- if ChargingSound.Playing then
- ChargingSound:Stop()
- end
- if Module.ChargingSoundIncreasePitch then
- ChargingSound.PlaybackSpeed = Module.ChargingSoundPitchRange[1]
- end
- end
- if not Variables.ActuallyEquipped then
- Variables.Charged = false
- Variables.Enabled = true
- end
- 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
- Variables.Charged = false
- for i = 1, (Module.BurstFireEnabled and Module.BulletPerBurst or 1) do
- if not Variables.ActuallyEquipped then
- break
- end
- Variables.ShotID = Variables.ShotID + 1
- local LastShotID = Variables.ShotID
- local CLDirections = {}
- local SVDirections = {}
- --VVV Edit here VVV--
- --Knockback.t = 1 * Vector3.new(-1, -20 * 0.005, 0)
- --^^^ Edit here ^^^--
- Thread:Spawn(RecoilCamera)
- CrossSpring:Accelerate(Module.CrossExpansion)
- if not Module.ShotgunPump then
- Thread:Spawn(function()
- local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.BulletShellDelay
- if Variables.ActuallyEquipped then
- EjectShell(((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1) and VMHandleToFire or HandleToFire)
- end
- end)
- end
- local SoundFolder = HandleToFire.FireSounds
- local Tracks = SoundFolder:GetChildren()
- local Chosen = math.random(1, #Tracks)
- local Track = Tracks[Chosen]
- if Track ~= nil then
- AudioHandler:PlayAudio({
- SoundId = Track.SoundId,
- EmitterSize = Track.EmitterSize,
- MaxDistance = Track.MaxDistance,
- Volume = Track.Volume,
- Pitch = Track.PlaybackSpeed,
- Origin = HandleToFire:FindFirstChild("GunMuzzlePoint"),
- Echo = Module.EchoEffect,
- Silenced = Module.SilenceEffect
- },
- {
- Enabled = Module.LowAmmo,
- CurrentAmmo = Variables.Mag,
- AmmoPerMag = Module.AmmoPerMag,
- SoundId = HandleToFire.LowAmmoSound.SoundId,
- EmitterSize = HandleToFire.LowAmmoSound.EmitterSize,
- MaxDistance = HandleToFire.LowAmmoSound.MaxDistance,
- Volume = HandleToFire.LowAmmoSound.Volume,
- Pitch = Module.RaisePitch and (math.max(math.abs(Variables.Mag / 10 - 1), 0.4)) or HandleToFire.LowAmmoSound.PlaybackSpeed,
- Origin = HandleToFire:FindFirstChild("GunMuzzlePoint")
- }, true)
- end
- local MuzzleFolder = VisualEffects.MuzzleEffect
- MuzzleHandler:VisualizeMuzzle(HandleToFire,
- (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 and VMHandleToFire or nil,
- Module.MuzzleFlashEnabled,
- {Module.MuzzleLightEnabled,Module.LightBrightness,Module.LightColor,Module.LightRange,Module.LightShadows,Module.VisibleTime},
- MuzzleFolder,
- true)
- Variables.CurrentRate = Variables.CurrentRate + Module.SmokeTrailRateIncrement
- for ii = 1, (Module.ShotgunEnabled and Module.BulletPerShot or 1) do
- local Position = Get3DPosition(GUI.Crosshair.AbsolutePosition)
- local CurrentSpread = Module.Spread * 10 * (Variables.AimDown and 1 - Module.SpreadRedutionIS and 1 - Module.SpreadRedutionS or 1)
- 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)
- local svCframe = CFrame.new(HandleToFire:FindFirstChild("GunFirePoint").WorldPosition, Position)
- local X, Y = Module.SpreadPattern[ii][1], Module.SpreadPattern[ii][2]
- local SpreadPattern = CFrame.Angles(math.rad(CurrentSpread * Y / 50), math.rad(CurrentSpread * X / 50), 0)
- local SpreadNormal = CFrame.Angles(math.rad(math.random(-CurrentSpread, CurrentSpread) / 50), math.rad(math.random(-CurrentSpread, CurrentSpread) / 50), 0)
- if Module.ShotgunPattern and Module.SpreadPattern then
- cframe = cframe * SpreadPattern
- svCframe = svCframe * SpreadPattern
- else
- cframe = cframe * SpreadNormal
- svCframe = svCframe * SpreadNormal
- end
- local ClDirection = cframe.LookVector
- local SvDirection = svCframe.LookVector
- table.insert(CLDirections, ClDirection)
- table.insert(SVDirections, SvDirection)
- end
- if Module.SelfKnockback then
- local KnockbackPosition = Get3DPosition(GUI.Crosshair.AbsolutePosition)
- SelfKnockback(KnockbackPosition, Torso.Position)
- end
- Fire(HandleToFire, VMHandleToFire, CLDirections, SVDirections)
- if Module.BatteryEnabled then
- Variables.ShotsForDepletion = Variables.ShotsForDepletion + 1
- if Variables.ShotsForDepletion >= Module.ShotsForDepletion then
- Variables.ShotsForDepletion = 0
- Variables.Ammo = Variables.Ammo - Random.new():NextInteger(Module.MinDepletion, Module.MaxDepletion)
- end
- Variables.Heat = Variables.Heat + Random.new():NextInteger(Module.HeatPerFireMin, Module.HeatPerFireMax)
- else
- if Module.MagCartridge and not Module.BatteryEnabled and Module.AmmoPerMag ~= math.huge then
- local Bullet = GUI.MagCartridge:FindFirstChild(Variables.Mag)
- if Module.Ejection then
- local vel = Random2DDirection(Module.Velocity, math.random(Module.XMin, Module.XMax), math.random(Module.YMin, Module.YMax)) * (math.random() ^ 0.5)
- CreateTwoDeeShell(Bullet.Rotation, Bullet.AbsolutePosition, Bullet.AbsoluteSize, vel, "shell", Module.Shockwave)
- end
- Bullet.Visible = false
- end
- Variables.Mag = Variables.Mag - 1
- end
- ChangeMagAndAmmo:FireServer(Variables.Mag, Variables.Ammo, Variables.Heat)
- Thread:Spawn(function()
- local Interrupted = false
- local StartTime = os.clock() repeat Thread:Wait() if LastShotID ~= Variables.ShotID then break end until (os.clock() - StartTime) >= Module.TimeBeforeCooldown
- if LastShotID ~= Variables.ShotID then Interrupted = true end
- if not Interrupted then
- Variables.CanBeCooledDown = true
- end
- end)
- UpdateGUI()
- if Module.BurstFireEnabled then
- local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.BurstRate
- --Thread:Wait(Module.BurstRate)
- end
- --[[if not Variables.ActuallyEquipped then
- break
- end]]
- if Module.BatteryEnabled then
- if Variables.Heat >= Module.MaxHeat then
- break
- end
- else
- if Variables.Mag <= 0 then
- break
- end
- end
- end
- if not Module.ShotgunPump then
- HandleToFire = (HandleToFire == Handle and Module.DualEnabled) and Handle2 or Handle
- VMHandleCounts = (VMHandleCounts == 1 and Module.DualEnabled) and 2 or 1
- VMHandleToFire = VMHandleCounts == 1 and VMHandle or VMHandle2
- if Module.AimAnimationsEnabled then
- CurrentAimFireAnim = (CurrentAimFireAnim == Animations.AimFireAnim and Module.SecondaryFireAnimationEnabled) and Animations.AimSecondaryFireAnim or Animations.AimFireAnim
- CurrentAimFireAnimationSpeed = (CurrentAimFireAnimationSpeed == Module.AimFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.AimSecondaryFireAnimationSpeed or Module.AimFireAnimationSpeed
- end
- CurrentFireAnim = (CurrentFireAnim == Animations.FireAnim and Module.SecondaryFireAnimationEnabled) and Animations.SecondaryFireAnim or Animations.FireAnim
- CurrentFireAnimationSpeed = (CurrentFireAnimationSpeed == Module.FireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.SecondaryFireAnimationSpeed or Module.FireAnimationSpeed
- CurrentVMFireAnim = (CurrentVMFireAnim == VMAnimations.VMFireAnim and Module.SecondaryFireAnimationEnabled) and VMAnimations.VMSecondaryFireAnim or VMAnimations.VMFireAnim
- CurrentVMFireAnimationSpeed = (CurrentVMFireAnimationSpeed == Module.VMFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.VMSecondaryFireAnimationSpeed or Module.VMFireAnimationSpeed
- end
- Thread:Wait(Module.FireRate)
- if (Module.BatteryEnabled and Variables.Heat >= Module.MaxHeat or Variables.Mag <= 0) then
- if Variables.CurrentRate >= Module.MaximumRate and Module.SmokeTrailEnabled then
- Thread:Spawn(function()
- SmokeTrail:StopEmission()
- SmokeTrail:EmitSmokeTrail(HandleToFire.SmokeTrail, VMHandleToFire.SmokeTrail, Module.MaximumTime)
- end)
- end
- end
- if Module.ShotgunPump then
- if Variables.ActuallyEquipped then
- if CurrentShotgunPumpinAnim then
- CurrentShotgunPumpinAnim:Play(nil, nil, CurrentShotgunPumpinAnimationSpeed)
- end
- if CurrentVMShotgunPumpinAnim then
- CurrentVMShotgunPumpinAnim:Play(nil, nil, CurrentVMShotgunPumpinAnimationSpeed)
- end
- if HandleToFire:FindFirstChild("PumpSound") then
- HandleToFire.PumpSound:Play()
- end
- Thread:Spawn(function()
- local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.BulletShellDelay
- if Variables.ActuallyEquipped then
- EjectShell(((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1) and VMHandleToFire or HandleToFire)
- end
- end)
- end
- HandleToFire = (HandleToFire == Handle and Module.DualEnabled) and Handle2 or Handle
- VMHandleCounts = (VMHandleCounts == 1 and Module.DualEnabled) and 2 or 1
- VMHandleToFire = VMHandleCounts == 1 and VMHandle or VMHandle2
- if Module.AimAnimationsEnabled then
- CurrentAimFireAnim = (CurrentAimFireAnim == Animations.AimFireAnim and Module.SecondaryFireAnimationEnabled) and Animations.AimSecondaryFireAnim or Animations.AimFireAnim
- CurrentAimFireAnimationSpeed = (CurrentAimFireAnimationSpeed == Module.AimFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.AimSecondaryFireAnimationSpeed or Module.AimFireAnimationSpeed
- end
- CurrentFireAnim = (CurrentFireAnim == Animations.FireAnim and Module.SecondaryFireAnimationEnabled) and Animations.SecondaryFireAnim or Animations.FireAnim
- CurrentFireAnimationSpeed = (CurrentFireAnimationSpeed == Module.FireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.SecondaryFireAnimationSpeed or Module.FireAnimationSpeed
- CurrentVMFireAnim = (CurrentVMFireAnim == VMAnimations.VMFireAnim and Module.SecondaryFireAnimationEnabled) and VMAnimations.VMSecondaryFireAnim or VMAnimations.VMFireAnim
- CurrentVMFireAnimationSpeed = (CurrentVMFireAnimationSpeed == Module.VMFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.VMSecondaryFireAnimationSpeed or Module.VMFireAnimationSpeed
- CurrentShotgunPumpinAnim = (CurrentShotgunPumpinAnim == Animations.ShotgunPumpinAnim and Module.SecondaryShotgunPump) and Animations.SecondaryShotgunPumpinAnim or Animations.ShotgunPumpinAnim
- CurrentShotgunPumpinAnimationSpeed = (CurrentShotgunPumpinAnimationSpeed == Module.ShotgunPumpinAnimationSpeed and Module.SecondaryShotgunPump) and Module.SecondaryShotgunPumpinAnimationSpeed or Module.ShotgunPumpinAnimationSpeed
- CurrentVMShotgunPumpinAnim = (CurrentVMShotgunPumpinAnim == VMAnimations.VMShotgunPumpinAnim and Module.SecondaryShotgunPump) and VMAnimations.VMSecondaryShotgunPumpinAnim or VMAnimations.VMShotgunPumpinAnim
- CurrentVMShotgunPumpinAnimationSpeed = (CurrentVMShotgunPumpinAnimationSpeed == Module.VMShotgunPumpinAnimationSpeed and Module.SecondaryShotgunPump) and Module.VMSecondaryShotgunPumpinAnimationSpeed or Module.VMShotgunPumpinAnimationSpeed
- Thread:Wait(Module.ShotgunPumpinSpeed)
- end
- Variables.Enabled = true
- if Variables.ActuallyEquipped then
- if Module.BatteryEnabled then
- if Variables.Heat >= Module.MaxHeat then
- Overheat()
- end
- else
- if Module.AutoReload then
- if Variables.Mag <= 0 then
- Reload()
- end
- end
- end
- end
- end
- end
- else
- Variables.Down = true
- local IsChargedShot = false
- 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
- Variables.CanBeCooledDown = false
- Variables.Enabled = false
- if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
- Animations.InspectAnim:Stop()
- end
- if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
- VMAnimations.VMInspectAnim:Stop()
- end
- if Module.ChargedShotEnabled then
- if Variables.ActuallyEquipped and HandleToFire:FindFirstChild("ChargeSound") then
- HandleToFire.ChargeSound:Play()
- end
- Thread:Wait(Module.ChargingTime)
- IsChargedShot = true
- end
- if Module.MinigunEnabled then
- if Animations.MinigunRevUpAnim and not Animations.MinigunRevUpAnim.IsPlaying then
- Animations.MinigunRevUpAnim:Play(nil, nil, Module.MinigunRevUpAnimationSpeed)
- end
- if VMAnimations.VMMinigunRevUpAnim and not VMAnimations.VMMinigunRevUpAnim.IsPlaying then
- VMAnimations.VMMinigunRevUpAnim:Play(nil, nil, Module.VMMinigunRevUpAnimationSpeed)
- end
- if Variables.ActuallyEquipped and HandleToFire:FindFirstChild("WindUp") then
- HandleToFire.WindUp:Play()
- end
- Thread:Wait(Module.DelayBeforeFiring)
- end
- 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
- IsChargedShot = false
- 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
- if not Variables.ActuallyEquipped then
- break
- end
- Variables.ShotID = Variables.ShotID + 1
- local LastShotID = Variables.ShotID
- local Directions = {}
- local CLDirections = {}
- local SVDirections = {}
- --VVV Edit here VVV--
- --Knockback.t = 1 * Vector3.new(-1, -20 * 0.005, 0)
- --^^^ Edit here ^^^--
- Thread:Spawn(RecoilCamera)
- CrossSpring:Accelerate(Module.CrossExpansion)
- if not Module.ShotgunPump then
- Thread:Spawn(function()
- local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.BulletShellDelay
- if Variables.ActuallyEquipped then
- EjectShell(((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1) and VMHandleToFire or HandleToFire)
- end
- end)
- end
- local Tracks = HandleToFire.FireSounds:GetChildren()
- local Chosen = math.random(1, #Tracks)
- local Track = Tracks[Chosen]
- if Track ~= nil then
- AudioHandler:PlayAudio({
- SoundId = Track.SoundId,
- EmitterSize = Track.EmitterSize,
- MaxDistance = Track.MaxDistance,
- Volume = Track.Volume,
- Pitch = Track.PlaybackSpeed,
- Origin = HandleToFire:FindFirstChild("GunMuzzlePoint"),
- Echo = Module.EchoEffect,
- Silenced = Module.SilenceEffect
- },
- {
- Enabled = Module.LowAmmo,
- CurrentAmmo = Variables.Mag,
- AmmoPerMag = Module.AmmoPerMag,
- SoundId = HandleToFire.LowAmmoSound.SoundId,
- EmitterSize = HandleToFire.LowAmmoSound.EmitterSize,
- MaxDistance = HandleToFire.LowAmmoSound.MaxDistance,
- Volume = HandleToFire.LowAmmoSound.Volume,
- Pitch = Module.RaisePitch and (math.max(math.abs(Variables.Mag / 10 - 1), 0.4)) or HandleToFire.LowAmmoSound.PlaybackSpeed,
- Origin = HandleToFire:FindFirstChild("GunMuzzlePoint")
- }, true)
- end
- local MuzzleFolder = VisualEffects.MuzzleEffect
- MuzzleHandler:VisualizeMuzzle(HandleToFire,
- (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 and VMHandleToFire or nil,
- Module.MuzzleFlashEnabled,
- {Module.MuzzleLightEnabled,Module.LightBrightness,Module.LightColor,Module.LightRange,Module.LightShadows,Module.VisibleTime},
- MuzzleFolder,
- true)
- Variables.CurrentRate = Variables.CurrentRate + Module.SmokeTrailRateIncrement
- for ii = 1, (Module.ShotgunEnabled and Module.BulletPerShot or 1) do
- local Position = Get3DPosition(GUI.Crosshair.AbsolutePosition)
- local Spread = Module.Spread * 10 * (Variables.AimDown and 1 - Module.SpreadRedutionIS and 1 - Module.SpreadRedutionS or 1)
- 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)
- local svCframe = CFrame.new(HandleToFire:FindFirstChild("GunFirePoint").WorldPosition, Position)
- local X, Y = Module.SpreadPattern[ii][1], Module.SpreadPattern[ii][2]
- local SpreadPattern = CFrame.Angles(math.rad(Spread * Y / 50), math.rad(Spread * X / 50), 0)
- local SpreadNormal = CFrame.Angles(math.rad(math.random(-Spread, Spread) / 50), math.rad(math.random(-Spread, Spread) / 50), 0)
- if Module.ShotgunPattern and Module.SpreadPattern then
- cframe = cframe * SpreadPattern
- svCframe = svCframe * SpreadPattern
- else
- cframe = cframe * SpreadNormal
- svCframe = svCframe * SpreadNormal
- end
- local ClDirection = cframe.LookVector
- local SvDirection = svCframe.LookVector
- table.insert(CLDirections, ClDirection)
- table.insert(SVDirections, SvDirection)
- end
- if Module.SelfKnockback then
- local KnockbackPosition = Get3DPosition(GUI.Crosshair.AbsolutePosition)
- SelfKnockback(KnockbackPosition, Torso.Position)
- end
- Fire(HandleToFire, VMHandleToFire, CLDirections, SVDirections)
- if Module.BatteryEnabled then
- Variables.ShotsForDepletion = Variables.ShotsForDepletion + 1
- if Variables.ShotsForDepletion >= Module.ShotsForDepletion then
- Variables.ShotsForDepletion = 0
- Variables.Ammo = Variables.Ammo - Random.new():NextInteger(Module.MinDepletion, Module.MaxDepletion)
- end
- Variables.Heat = Variables.Heat + Random.new():NextInteger(Module.HeatPerFireMin, Module.HeatPerFireMax)
- else
- if Module.MagCartridge and not Module.BatteryEnabled and Module.AmmoPerMag ~= math.huge then
- local Bullet = GUI.MagCartridge:FindFirstChild(Variables.Mag)
- if Module.Ejection then
- local Vel = Random2DDirection(Module.Velocity, math.random(Module.XMin, Module.XMax), math.random(Module.YMin, Module.YMax)) * (math.random() ^ 0.5)
- CreateTwoDeeShell(Bullet.Rotation, Bullet.AbsolutePosition, Bullet.AbsoluteSize, Vel, "shell", Module.Shockwave)
- end
- Bullet.Visible = false
- end
- Variables.Mag = Variables.Mag - 1
- end
- ChangeMagAndAmmo:FireServer(Variables.Mag, Variables.Ammo, Variables.Heat)
- Thread:Spawn(function()
- local Interrupted = false
- local StartTime = os.clock() repeat Thread:Wait() if LastShotID ~= Variables.ShotID then break end until (os.clock() - StartTime) >= Module.TimeBeforeCooldown
- if LastShotID ~= Variables.ShotID then Interrupted = true end
- if not Interrupted then
- Variables.CanBeCooledDown = true
- end
- end)
- UpdateGUI()
- if Module.BurstFireEnabled and not Module.SelectiveFireEnabled then
- local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.BurstRate
- --Thread:Wait(Module.BurstRate)
- end
- if Module.SelectiveFireEnabled then
- local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.BurstRates[Variables.FireMode]
- --Thread:Wait(Module.BurstRates[Variables.FireMode])
- end
- --[[if not Variables.ActuallyEquipped then
- break
- end]]
- if Module.BatteryEnabled then
- if Variables.Heat >= Module.MaxHeat then
- break
- end
- else
- if Variables.Mag <= 0 then
- break
- end
- end
- end
- if not Module.ShotgunPump then
- HandleToFire = (HandleToFire == Handle and Module.DualEnabled) and Handle2 or Handle
- VMHandleCounts = (VMHandleCounts == 1 and Module.DualEnabled) and 2 or 1
- VMHandleToFire = VMHandleCounts == 1 and VMHandle or VMHandle2
- if Module.AimAnimationsEnabled then
- CurrentAimFireAnim = (CurrentAimFireAnim == Animations.AimFireAnim and Module.SecondaryFireAnimationEnabled) and Animations.AimSecondaryFireAnim or Animations.AimFireAnim
- CurrentAimFireAnimationSpeed = (CurrentAimFireAnimationSpeed == Module.AimFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.AimSecondaryFireAnimationSpeed or Module.AimFireAnimationSpeed
- end
- CurrentFireAnim = (CurrentFireAnim == Animations.FireAnim and Module.SecondaryFireAnimationEnabled) and Animations.SecondaryFireAnim or Animations.FireAnim
- CurrentFireAnimationSpeed = (CurrentFireAnimationSpeed == Module.FireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.SecondaryFireAnimationSpeed or Module.FireAnimationSpeed
- CurrentVMFireAnim = (CurrentVMFireAnim == VMAnimations.VMFireAnim and Module.SecondaryFireAnimationEnabled) and VMAnimations.VMSecondaryFireAnim or VMAnimations.VMFireAnim
- CurrentVMFireAnimationSpeed = (CurrentVMFireAnimationSpeed == Module.VMFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.VMSecondaryFireAnimationSpeed or Module.VMFireAnimationSpeed
- end
- Thread:Wait(Module.SelectiveFireEnabled and Module.FireRates[Variables.FireMode] or Module.FireRate)
- if (Module.BatteryEnabled and Variables.Heat >= Module.MaxHeat or Variables.Mag <= 0) then
- if Variables.CurrentRate >= Module.MaximumRate and Module.SmokeTrailEnabled then
- Thread:Spawn(function()
- SmokeTrail:StopEmission()
- SmokeTrail:EmitSmokeTrail(HandleToFire.SmokeTrail, Module.MaximumTime)
- end)
- end
- end
- if Module.SelectiveFireEnabled then
- if Variables.FireModes[Variables.FireMode] ~= true then
- break
- end
- else
- if not Module.Auto then
- break
- end
- end
- end
- --[[if HandleToFire.FireSound.Playing and HandleToFire.FireSound.Looped then
- HandleToFire.FireSound:Stop()
- end]]
- if Module.MinigunEnabled then
- if Variables.ActuallyEquipped and Animations.MinigunRevDownAnim and not Animations.MinigunRevDownAnim.IsPlaying then
- Animations.MinigunRevDownAnim:Play(nil, nil, Module.MinigunRevDownAnimationSpeed)
- end
- if Animations.MinigunRevUpAnim and Animations.MinigunRevUpAnim.IsPlaying then
- Animations.MinigunRevUpAnim:Stop()
- end
- if Variables.ActuallyEquipped and VMAnimations.VMMinigunRevDownAnim and not VMAnimations.VMMinigunRevDownAnim.IsPlaying then
- VMAnimations.VMMinigunRevDownAnim:Play(nil, nil, Module.VMMinigunRevDownAnimationSpeed)
- end
- if VMAnimations.VMMinigunRevUpAnim and VMAnimations.VMMinigunRevUpAnim.IsPlaying then
- VMAnimations.VMMinigunRevUpAnim:Stop()
- end
- if Variables.ActuallyEquipped and HandleToFire:FindFirstChild("WindDown") then
- HandleToFire.WindDown:Play()
- end
- Thread:Wait(Module.DelayAfterFiring)
- end
- if Module.ShotgunPump then
- if Variables.ActuallyEquipped then
- if CurrentShotgunPumpinAnim then
- CurrentShotgunPumpinAnim:Play(nil, nil, CurrentShotgunPumpinAnimationSpeed)
- end
- if CurrentVMShotgunPumpinAnim then
- CurrentVMShotgunPumpinAnim:Play(nil, nil, CurrentVMShotgunPumpinAnimationSpeed)
- end
- if HandleToFire:FindFirstChild("PumpSound") then
- HandleToFire.PumpSound:Play()
- end
- Thread:Spawn(function()
- local StartTime = os.clock() repeat Thread:Wait() if not Variables.ActuallyEquipped then break end until (os.clock() - StartTime) >= Module.BulletShellDelay
- if Variables.ActuallyEquipped then
- EjectShell(((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1) and VMHandleToFire or HandleToFire)
- end
- end)
- end
- HandleToFire = (HandleToFire == Handle and Module.DualEnabled) and Handle2 or Handle
- VMHandleCounts = (VMHandleCounts == 1 and Module.DualEnabled) and 2 or 1
- VMHandleToFire = VMHandleCounts == 1 and VMHandle or VMHandle2
- if Module.AimAnimationsEnabled then
- CurrentAimFireAnim = (CurrentAimFireAnim == Animations.AimFireAnim and Module.SecondaryFireAnimationEnabled) and Animations.AimSecondaryFireAnim or Animations.AimFireAnim
- CurrentAimFireAnimationSpeed = (CurrentAimFireAnimationSpeed == Module.AimFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.AimSecondaryFireAnimationSpeed or Module.AimFireAnimationSpeed
- end
- CurrentFireAnim = (CurrentFireAnim == Animations.FireAnim and Module.SecondaryFireAnimationEnabled) and Animations.SecondaryFireAnim or Animations.FireAnim
- CurrentFireAnimationSpeed = (CurrentFireAnimationSpeed == Module.FireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.SecondaryFireAnimationSpeed or Module.FireAnimationSpeed
- CurrentVMFireAnim = (CurrentVMFireAnim == VMAnimations.VMFireAnim and Module.SecondaryFireAnimationEnabled) and VMAnimations.VMSecondaryFireAnim or VMAnimations.VMFireAnim
- CurrentVMFireAnimationSpeed = (CurrentVMFireAnimationSpeed == Module.VMFireAnimationSpeed and Module.SecondaryFireAnimationEnabled) and Module.VMSecondaryFireAnimationSpeed or Module.VMFireAnimationSpeed
- CurrentShotgunPumpinAnim = (CurrentShotgunPumpinAnim == Animations.ShotgunPumpinAnim and Module.SecondaryShotgunPump) and Animations.SecondaryShotgunPumpinAnim or Animations.ShotgunPumpinAnim
- CurrentShotgunPumpinAnimationSpeed = (CurrentShotgunPumpinAnimationSpeed == Module.ShotgunPumpinAnimationSpeed and Module.SecondaryShotgunPump) and Module.SecondaryShotgunPumpinAnimationSpeed or Module.ShotgunPumpinAnimationSpeed
- CurrentVMShotgunPumpinAnim = (CurrentVMShotgunPumpinAnim == VMAnimations.VMShotgunPumpinAnim and Module.SecondaryShotgunPump) and VMAnimations.VMSecondaryShotgunPumpinAnim or VMAnimations.VMShotgunPumpinAnim
- CurrentVMShotgunPumpinAnimationSpeed = (CurrentVMShotgunPumpinAnimationSpeed == Module.VMShotgunPumpinAnimationSpeed and Module.SecondaryShotgunPump) and Module.VMSecondaryShotgunPumpinAnimationSpeed or Module.VMShotgunPumpinAnimationSpeed
- Thread:Wait(Module.ShotgunPumpinSpeed)
- end
- Variables.Enabled = true
- if Variables.ActuallyEquipped then
- if Module.BatteryEnabled then
- if Variables.Heat >= Module.MaxHeat then
- Overheat()
- end
- else
- if Module.AutoReload then
- if Variables.Mag <= 0 then
- Reload()
- end
- end
- end
- end
- end
- end
- end
- local function OnStoppingFiring()
- Variables.Down = false
- if Module.ChargedShotAdvanceEnabled or Module.HoldAndReleaseEnabled then
- Variables.Charging = false
- end
- if Module.HoldAndReleaseEnabled and not Variables.Charged then
- Variables.Enabled = true
- end
- if Variables.CurrentRate >= Module.MaximumRate and Module.SmokeTrailEnabled then
- Thread:Spawn(function()
- SmokeTrail:StopEmission()
- SmokeTrail:EmitSmokeTrail(HandleToFire.SmokeTrail, VMHandleToFire.SmokeTrail, Module.MaximumTime)
- end)
- end
- end
- local function OnMeleeSequenceTriggered(ShootingHandle, Range)
- local Direction = ((ShootingHandle.MeleeHitPoint.WorldCFrame * CFrame.new(0, 0, -Range)).p - ShootingHandle.MeleeHitPoint.WorldPosition).Unit
- local MeleeRay = Ray.new(ShootingHandle.MeleeHitPoint.WorldPosition, Direction * Range)
- local Hit, Pos, Norm, Material = Workspace:FindPartOnRayWithIgnoreList(MeleeRay, {Camera, Tool.Parent})
- if Hit then
- if Hit.Name == "_glass" then
- ShatterGlass:FireServer(Hit, Pos, Direction)
- else
- local Target = Hit:FindFirstAncestorOfClass("Model")
- local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
- local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
- if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
- ProjectileHandler:VisualizeHitEffect("Blood", true, Hit, Pos, Norm, Material, true,
- {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}},
- true)
- if TargetHumanoid.Health > 0 then
- Thread:Spawn(function()
- InflictTargetMelee:InvokeServer(Module,
- TargetHumanoid,
- TargetTorso,
- {Module.MeleeDamage,Module.MeleeHeadshotEnabled,Module.MeleeHeadshotDamageMultiplier},
- {Module.MeleeKnockback,Module.MeleeLifesteal,Module.MeleeAffliction,Module.MeleeAfflictionName,Module.MeleeAfflictChance},
- {Module.MeleeCriticalDamageEnabled,Module.MeleeCriticalBaseChance,Module.MeleeCriticalDamageMultiplier},
- Hit)
- end)
- MarkHit(Hit.Name == "Head" and Module.MeleeHeadshotEnabled)
- end
- else
- ProjectileHandler:VisualizeHitEffect("Normal", true, Hit, Pos, Norm, Material, true,
- {Module.MeleeHitEffectEnabled,Module.MeleeHitSoundIDs,Module.MeleeHitSoundPitchMin,Module.MeleeHitSoundPitchMax,Module.MeleeHitSoundVolume,script.MeleeHitEffect,Module.CustomMeleeHitEffect},
- {Module.MarkerEffectEnabled,Module.MarkerEffectSize,Module.MarkerEffectTexture,Module.MarkerPartColor,Module.MarkerEffectVisibleTime,Module.MarkerEffectFadeTime},
- true)
- end
- end
- end
- end
- local function OnMeleeAttacking()
- if Module.MeleeAttackEnabled then
- if (Animations.MeleeAttackAnim and Animations.MeleeAttackAnim.Length > 0) and (VMAnimations.VMMeleeAttackAnim and VMAnimations.VMMeleeAttackAnim.Length > 0) then
- local Connection
- local VMConnection
- if Variables.ActuallyEquipped and Variables.Enabled and not Variables.Reloading and not Variables.Overheated and not Variables.HoldDown and Humanoid.Health > 0 then
- Variables.Enabled = false
- if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
- Animations.InspectAnim:Stop()
- end
- if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
- VMAnimations.VMInspectAnim:Stop()
- end
- Animations.MeleeAttackAnim:Play(nil, nil, Module.MeleeAttackAnimationSpeed)
- VMAnimations.VMMeleeAttackAnim:Play(nil, nil, Module.VMMeleeAttackAnimationSpeed)
- if Variables.ActuallyEquipped and HandleToFire:FindFirstChild("MeleeSwingSound") then
- HandleToFire.MeleeSwingSound:Play()
- end
- Connection = Animations.MeleeAttackAnim:GetMarkerReachedSignal("MeleeDamageSequence"):Connect(function(ParamString)
- --print(ParamString)
- if ((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude > 1) then
- OnMeleeSequenceTriggered(Handle, Module.MeleeAttackRange)
- end
- if Connection then
- --print("Disconnected")
- Connection:Disconnect()
- Connection = nil
- end
- end)
- VMConnection = VMAnimations.VMMeleeAttackAnim:GetMarkerReachedSignal("MeleeDamageSequence"):Connect(function(ParamString)
- --print(ParamString)
- if ((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1) then
- OnMeleeSequenceTriggered(VMHandle, Module.VMMeleeAttackRange)
- end
- if VMConnection then
- --print("Disconnected")
- VMConnection:Disconnect()
- VMConnection = nil
- end
- end)
- if ((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1) then
- VMAnimations.VMMeleeAttackAnim.Stopped:Wait()
- else
- Animations.MeleeAttackAnim.Stopped:Wait()
- end
- Variables.Enabled = true
- end
- end
- end
- end
- local function OnUnequipping()
- SmokeTrail:StopEmission()
- if Module.ChargedShotAdvanceEnabled then
- Variables.Charging = false
- end
- if Module.HoldAndReleaseEnabled then
- Variables.Charged = false
- end
- Variables.Equipped = false
- Variables.HoldDown = false
- Variables.ActuallyEquipped = false
- if JumpButton then
- AimButton.Parent = GUI.MobileButtons
- FireButton.Parent = GUI.MobileButtons
- HoldDownButton.Parent = GUI.MobileButtons
- InspectButton.Parent = GUI.MobileButtons
- ReloadButton.Parent = GUI.MobileButtons
- SwitchButton.Parent = GUI.MobileButtons
- end
- GUI.Parent = script
- GUI.Frame.Visible = false
- if Module.WalkSpeedRedutionEnabled then
- Humanoid.WalkSpeed = Humanoid.WalkSpeed + Module.WalkSpeedRedution
- else
- Humanoid.WalkSpeed = Humanoid.WalkSpeed
- end
- UserInputService.MouseIconEnabled = false
- RunService:UnbindFromRenderStep(BindToStepName)
- for i, v in pairs(KeyframeConnections) do
- v:Disconnect()
- table.remove(KeyframeConnections, i)
- end
- for i, v in pairs(VMKeyframeConnections) do
- v:Disconnect()
- table.remove(VMKeyframeConnections, i)
- end
- table.clear(VMKeyframes)
- LockedEntity = nil
- TargetMarker.Enabled = false
- TargetMarker.Parent = nil
- TargetMarker.Adornee = nil
- if Beam then
- Beam:Destroy()
- Beam = nil
- end
- if Attach0 then
- Attach0:Destroy()
- Attach0 = nil
- end
- if Attach1 then
- Attach1:Destroy()
- Attach1 = nil
- end
- for _, a in pairs(Animations) do
- if a and a.IsPlaying then
- a:Stop()
- end
- end
- for _, vmA in pairs(VMAnimations) do
- if vmA and vmA.IsPlaying then
- vmA:Stop()
- end
- table.remove(VMAnimations, table.find(VMAnimations, vmA))
- end
- for _, s in pairs(Handle:GetChildren()) do
- if s:IsA("Sound") and s.IsPlaying then
- s:Stop()
- end
- end
- if Handle2 then
- for _, s in pairs(Handle2:GetChildren()) do
- if s:IsA("Sound") and s.IsPlaying then
- s:Stop()
- end
- end
- end
- if Variables.AimDown then
- TweenService:Create(Camera, TweenInfo.new(Module.TweenLengthNAD, Module.EasingStyleNAD, Module.EasingDirectionNAD), {FieldOfView = 70}):Play()
- SetCrossScale(1)
- if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
- Viewmodel.isAiming.Value = false
- end
- Variables.Scoping = false
- Player.CameraMode = Enum.CameraMode.Classic
- UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity
- Variables.AimDown = false
- end
- if Module.DualEnabled and not Workspace.FilteringEnabled then
- Handle2.CanCollide = true
- if Grip2 then
- Grip2:Destroy()
- end
- end
- ViewmodelHandler:CullViewmodel(Viewmodel)
- Viewmodel = nil
- FakeCamera = nil
- end
- --aiming
- AimButton.MouseButton1Click:Connect(function()
- OnTooglingAiming()
- end)
- --holding down gun
- HoldDownButton.MouseButton1Click:Connect(function()
- OnHoldingDown()
- end)
- --inspecting gun
- InspectButton.MouseButton1Click:Connect(function()
- OnInspecting()
- end)
- --switching mode
- SwitchButton.MouseButton1Click:Connect(function()
- OnSwitching()
- end)
- --reloading
- ReloadButton.MouseButton1Click:Connect(function()
- Reload()
- end)
- --firing
- FireButton.MouseButton1Down:Connect(function()
- OnFiring()
- end)
- --non firing
- FireButton.MouseButton1Up:Connect(function()
- OnStoppingFiring()
- end)
- --melee
- MeleeButton.MouseButton1Up:Connect(function()
- OnMeleeAttacking()
- end)
- UserInputService.InputBegan:Connect(function(Input, GameProcessed)
- if GameProcessed then
- return
- end
- if not UserInputService.TouchEnabled then
- if Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.KeyCode == Module.Controller.Fire then
- OnFiring()
- elseif Input.KeyCode == Module.Keyboard.Reload or Input.KeyCode == Module.Controller.Reload then
- Reload()
- elseif Input.KeyCode == Module.Keyboard.HoldDown or Input.KeyCode == Module.Controller.HoldDown then
- OnHoldingDown()
- elseif Input.KeyCode == Module.Keyboard.Inspect or Input.KeyCode == Module.Controller.Inspect then
- OnInspecting()
- elseif Input.KeyCode == Module.Keyboard.Switch or Input.KeyCode == Module.Controller.Switch then
- OnSwitching()
- elseif Input.KeyCode == Module.Keyboard.ToogleAim or Input.KeyCode == Module.Controller.ToogleAim then
- OnTooglingAiming()
- elseif Input.KeyCode == Module.Keyboard.Melee or Input.KeyCode == Module.Controller.Melee then
- OnMeleeAttacking()
- elseif Input.UserInputType == Enum.UserInputType.MouseButton2 then
- 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
- if not Module.KeepAimingOnReloading then
- if Variables.Reloading or Variables.Overheated then
- return
- end
- end
- TweenService:Create(Camera, TweenInfo.new(Module.TweenLength, Module.EasingStyle, Module.EasingDirection), {FieldOfView = Module.FieldOfViewIS}):Play()
- SetCrossScale(Module.CrossScaleIS)
- if Module.AimAnimationsEnabled and Animations.IdleAnim and Animations.IdleAnim.IsPlaying then
- Animations.IdleAnim:Stop()
- if Animations.AimIdleAnim then
- Animations.AimIdleAnim:Play(nil, nil, Module.AimIdleAnimationSpeed)
- end
- end
- if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
- Viewmodel.isAiming.Value = true
- end
- Player.CameraMode = Enum.CameraMode.LockFirstPerson
- UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity * Module.MouseSensitiveIS
- Variables.AimDown = true
- if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
- Animations.InspectAnim:Stop()
- end
- if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
- VMAnimations.VMInspectAnim:Stop()
- end
- 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
- if not Module.KeepAimingOnReloading then
- if Variables.Reloading or Variables.Overheated then
- return
- end
- end
- TweenService:Create(Camera, TweenInfo.new(Module.TweenLength, Module.EasingStyle, Module.EasingDirection), {FieldOfView = Module.FieldOfViewS}):Play()
- SetCrossScale(Module.CrossScaleS)
- if Animations.InspectAnim and Animations.InspectAnim.IsPlaying then
- Animations.InspectAnim:Stop()
- end
- if VMAnimations.VMInspectAnim and VMAnimations.VMInspectAnim.IsPlaying then
- VMAnimations.VMInspectAnim:Stop()
- end
- if Module.AimAnimationsEnabled and Animations.IdleAnim and Animations.IdleAnim.IsPlaying then
- Animations.IdleAnim:Stop()
- if Animations.AimIdleAnim then
- Animations.AimIdleAnim:Play(nil, nil, Module.AimIdleAnimationSpeed)
- end
- end
- if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
- Viewmodel.isAiming.Value = true
- end
- Variables.AimDown = true
- local StartTime = os.clock() repeat Thread:Wait() if not (Variables.ActuallyEquipped or Variables.AimDown) then break end until (os.clock() - StartTime) >= Module.ScopeDelay
- if Variables.ActuallyEquipped and Variables.AimDown then
- local ZoomSound = GUI.Scope.ZoomSound:Clone()
- ZoomSound.Parent = Player.PlayerGui
- ZoomSound:Play()
- ZoomSound.Ended:Connect(function()
- ZoomSound:Destroy()
- end)
- Player.CameraMode = Enum.CameraMode.LockFirstPerson
- UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity * Module.MouseSensitiveS
- Variables.Scoping = true
- end
- end
- end
- end
- end)
- UserInputService.InputEnded:Connect(function(Input, GameProcessed)
- if GameProcessed then
- return
- end
- if not UserInputService.TouchEnabled then
- if Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.KeyCode == Module.Controller.Fire then
- OnStoppingFiring()
- elseif Input.UserInputType == Enum.UserInputType.MouseButton2 then
- if Variables.AimDown then
- TweenService:Create(Camera, TweenInfo.new(Module.TweenLengthNAD, Module.EasingStyleNAD, Module.EasingDirectionNAD), {FieldOfView = 70}):Play()
- SetCrossScale(1)
- if Module.AimAnimationsEnabled and Animations.AimIdleAnim and Animations.AimIdleAnim.IsPlaying then
- Animations.AimIdleAnim:Stop()
- if Animations.IdleAnim then
- Animations.IdleAnim:Play(nil, nil, Module.IdleAnimationSpeed)
- end
- end
- if Viewmodel and Viewmodel:FindFirstChild("isAiming") then
- Viewmodel.isAiming.Value = false
- end
- Variables.Scoping = false
- Player.CameraMode = Enum.CameraMode.Classic
- UserInputService.MouseDeltaSensitivity = Variables.InitialSensitivity
- Variables.AimDown = false
- end
- end
- end
- end)
- MarkerEvent.Event:Connect(MarkHit)
- ChangeMagAndAmmo.OnClientEvent:Connect(function(ChangedMag, ChangedAmmo, ChangedHeat)
- Variables.Mag = ChangedMag
- Variables.Ammo = ChangedAmmo
- Variables.Heat = ChangedHeat
- UpdateGUI()
- end)
- Tool.Equipped:Connect(function()
- Variables.Equipped = true
- if JumpButton then
- AimButton.Parent = JumpButton
- FireButton.Parent = JumpButton
- HoldDownButton.Parent = JumpButton
- InspectButton.Parent = JumpButton
- ReloadButton.Parent = JumpButton
- SwitchButton.Parent = JumpButton
- end
- if Module.AmmoPerMag ~= math.huge or Module.MaxHeat ~= math.huge then
- GUI.Frame.Visible = true
- end
- GUI.Parent = Player.PlayerGui
- UpdateGUI()
- --Viewmodel
- Viewmodel = ViewmodelHandler:SetUpViewmodel(Tool.Name)
- FakeCamera = Viewmodel.PrimaryPart:FindFirstChild("FakeCamera") --If "FakeCamera" Motor6D parents outside viewmodel's PrimaryPart (HumanoidRootPart), consider changing the line below.
- VMHandle = Viewmodel:WaitForChild("Handle")
- if Module.DualEnabled then
- VMHandle2 = Viewmodel:WaitForChild("Handle2", 2)
- if VMHandle2 == nil and Module.DualEnabled then error("\"Dual\" setting is enabled but \"VMHandle2\" is missing!") end
- end
- VMHandleCounts = 1
- VMHandleToFire = VMHandleCounts == 1 and VMHandle or VMHandle2
- if Module.VMIdleAnimationID ~= nil then
- VMAnimations.VMIdleAnim = Tool:WaitForChild("VMIdleAnim")
- VMAnimations.VMIdleAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMIdleAnim)
- FindAnimationNameForKeyframe(VMAnimations.VMIdleAnim, true)
- end
- if Module.VMFireAnimationID ~= nil then
- VMAnimations.VMFireAnim = Tool:WaitForChild("VMFireAnim")
- VMAnimations.VMFireAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMFireAnim)
- FindAnimationNameForKeyframe(VMAnimations.VMFireAnim, true)
- end
- if Module.VMReloadAnimationID ~= nil then
- VMAnimations.VMReloadAnim = Tool:WaitForChild("VMReloadAnim")
- VMAnimations.VMReloadAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMReloadAnim)
- FindAnimationNameForKeyframe(VMAnimations.VMReloadAnim, true)
- end
- if Module.VMShotgunClipinAnimationID ~= nil then
- VMAnimations.VMShotgunClipinAnim = Tool:WaitForChild("VMShotgunClipinAnim")
- VMAnimations.VMShotgunClipinAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMShotgunClipinAnim)
- FindAnimationNameForKeyframe(VMAnimations.VMShotgunClipinAnim, true)
- end
- if Module.VMShotgunPumpinAnimationID ~= nil then
- VMAnimations.VMShotgunPumpinAnim = Tool:WaitForChild("VMShotgunPumpinAnim")
- VMAnimations.VMShotgunPumpinAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMShotgunPumpinAnim)
- FindAnimationNameForKeyframe(VMAnimations.VMShotgunPumpinAnim, true)
- end
- if Module.VMSecondaryShotgunPumpinAnimationID ~= nil then
- VMAnimations.VMSecondaryShotgunPumpinAnim = Tool:WaitForChild("VMSecondaryShotgunPumpinAnim")
- VMAnimations.VMSecondaryShotgunPumpinAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMSecondaryShotgunPumpinAnim)
- FindAnimationNameForKeyframe(VMAnimations.VMSecondaryShotgunPumpinAnim, true)
- end
- if Module.VMHoldDownAnimationID ~= nil then
- VMAnimations.VMHoldDownAnim = Tool:WaitForChild("VMHoldDownAnim")
- VMAnimations.VMHoldDownAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMHoldDownAnim)
- FindAnimationNameForKeyframe(VMAnimations.VMHoldDownAnim, true)
- end
- if Module.VMEquippedAnimationID ~= nil then
- VMAnimations.VMEquippedAnim = Tool:WaitForChild("VMEquippedAnim")
- VMAnimations.VMEquippedAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMEquippedAnim)
- FindAnimationNameForKeyframe(VMAnimations.VMEquippedAnim, true)
- end
- if Module.SecondaryFireAnimationEnabled and Module.VMSecondaryFireAnimationID ~= nil then
- VMAnimations.VMSecondaryFireAnim = Tool:WaitForChild("VMSecondaryFireAnim")
- VMAnimations.VMSecondaryFireAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMSecondaryFireAnim)
- FindAnimationNameForKeyframe(VMAnimations.VMSecondaryFireAnim, true)
- end
- if Module.TacticalReloadAnimationEnabled and Module.VMTacticalReloadAnimationID ~= nil then
- VMAnimations.VMTacticalReloadAnim = Tool:WaitForChild("VMTacticalReloadAnim")
- VMAnimations.VMTacticalReloadAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMTacticalReloadAnim)
- FindAnimationNameForKeyframe(VMAnimations.VMTacticalReloadAnim, true)
- end
- if Module.InspectAnimationEnabled and Module.VMInspectAnimationID ~= nil then
- VMAnimations.VMInspectAnim = Tool:WaitForChild("VMInspectAnim")
- VMAnimations.VMInspectAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMInspectAnim)
- FindAnimationNameForKeyframe(VMAnimations.VMInspectAnim, true)
- end
- if Module.ShotgunReload and Module.PreShotgunReload and Module.VMPreShotgunReloadAnimationID ~= nil then
- VMAnimations.VMPreShotgunReloadAnim = Tool:WaitForChild("PreShotgunReloadAnim")
- VMAnimations.VMPreShotgunReloadAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.PreShotgunReloadAnim)
- FindAnimationNameForKeyframe(VMAnimations.VMPreShotgunReloadAnim, true)
- end
- if Module.VMMinigunRevUpAnimationID ~= nil then
- VMAnimations.VMMinigunRevUpAnim = Tool:WaitForChild("VMMinigunRevUpAnim")
- VMAnimations.VMMinigunRevUpAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMMinigunRevUpAnim)
- FindAnimationNameForKeyframe(VMAnimations.VMMinigunRevUpAnim, true)
- end
- if Module.MinigunRevDownAnimationID ~= nil then
- VMAnimations.VMMinigunRevDownAnim = Tool:WaitForChild("VMMinigunRevDownAnim")
- VMAnimations.VMMinigunRevDownAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMMinigunRevDownAnim)
- FindAnimationNameForKeyframe(VMAnimations.VMMinigunRevDownAnim, true)
- end
- if Module.ChargingAnimationEnabled and Module.ChargingAnimationID ~= nil then
- VMAnimations.VMChargingAnim = Tool:WaitForChild("VMChargingAnim")
- VMAnimations.VMChargingAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMChargingAnim)
- FindAnimationNameForKeyframe(VMAnimations.VMChargingAnim, true)
- end
- if Module.SelectiveFireEnabled and Module.VMSwitchAnimationID ~= nil then
- VMAnimations.VMSwitchAnim = Tool:WaitForChild("VMSwitchAnim")
- VMAnimations.VMSwitchAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMSwitchAnim)
- FindAnimationNameForKeyframe(VMAnimations.VMSwitchAnim, true)
- end
- if Module.BatteryEnabled and Module.VMOverheatAnimationID ~= nil then
- VMAnimations.VMOverheatAnim = Tool:WaitForChild("VMOverheatAnim")
- VMAnimations.VMOverheatAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMOverheatAnim)
- FindAnimationNameForKeyframe(VMAnimations.VMOverheatAnim, true)
- end
- if Module.MeleeAttackEnabled and Module.VMMeleeAttackAnimationID ~= nil then
- VMAnimations.VMMeleeAttackAnim = Tool:WaitForChild("VMMeleeAttackAnim")
- VMAnimations.VMMeleeAttackAnim = Viewmodel:WaitForChild("Animation"):LoadAnimation(VMAnimations.VMMeleeAttackAnim)
- FindAnimationNameForKeyframe(VMAnimations.VMMeleeAttackAnim, true)
- end
- CurrentVMFireAnim = VMAnimations.VMFireAnim
- CurrentVMFireAnimationSpeed = Module.VMFireAnimationSpeed
- CurrentVMShotgunPumpinAnim = VMAnimations.VMShotgunPumpinAnim
- CurrentVMShotgunPumpinAnimationSpeed = Module.VMShotgunPumpinAnimationSpeed
- --
- Handle.EquippedSound:Play()
- if Module.WalkSpeedRedutionEnabled then
- Humanoid.WalkSpeed = Humanoid.WalkSpeed - Module.WalkSpeedRedution
- else
- Humanoid.WalkSpeed = Humanoid.WalkSpeed
- end
- SetCrossSettings(Module.CrossSize, Module.CrossSpeed, Module.CrossDamper)
- UserInputService.MouseIconEnabled = false
- if Module.ProjectileMotion then
- Beam, Attach0, Attach1 = ProjectileMotion.ShowProjectilePath(script:WaitForChild("MotionBeam"), HandleToFire:FindFirstChild("GunFirePoint").WorldPosition, Vector3.new(), 3, AddressTableValue(Module.ChargeAlterTable.BulletAcceleration, Module.BulletAcceleration))
- end
- RunService:BindToRenderStep(BindToStepName, Enum.RenderPriority.Camera.Value, function(dt)
- --Update crosshair and scope
- RenderMouse()
- RenderScope()
- RenderCrosshair()
- --Update camera
- RenderCam()
- --Update rate
- RenderRate(dt)
- --Render motion
- if Module.ProjectileMotion then
- RenderMotion()
- end
- --Render cooldown
- if Module.BatteryEnabled then
- RenderCooldown(dt)
- end
- --Render 2D shell
- RenderTwoDeeShell(dt)
- end)
- for _, v in pairs(Keyframes) do
- table.insert(KeyframeConnections, v[1]:GetMarkerReachedSignal("AnimationEvents"):Connect(function(keyframeName)
- if v[2][keyframeName] then
- if ((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude > 1) then
- v[2][keyframeName](keyframeName, Tool)
- end
- end
- end))
- end
- for _, v in pairs(VMKeyframes) do
- table.insert(VMKeyframeConnections, v[1]:GetMarkerReachedSignal("AnimationEvents"):Connect(function(keyframeName)
- if v[2][keyframeName] then
- if ((Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1) then
- v[2][keyframeName](keyframeName, Tool, Viewmodel)
- end
- end
- end))
- end
- if Animations.EquippedAnim then
- Animations.EquippedAnim:Play(nil, nil, Module.EquippedAnimationSpeed)
- end
- if Animations.IdleAnim then
- Animations.IdleAnim:Play(nil, nil, Module.IdleAnimationSpeed)
- end
- if VMAnimations.VMEquippedAnim then
- VMAnimations.VMEquippedAnim:Play(nil, nil, Module.VMEquippedAnimationSpeed)
- end
- if VMAnimations.VMIdleAnim then
- VMAnimations.VMIdleAnim:Play(nil, nil, Module.VMIdleAnimationSpeed)
- end
- if Module.DualEnabled and not Workspace.FilteringEnabled then
- Handle2.CanCollide = false
- local LeftArm = Tool.Parent:FindFirstChild("Left Arm") or Tool.Parent:FindFirstChild("LeftHand")
- local RightArm = Tool.Parent:FindFirstChild("Right Arm") or Tool.Parent:FindFirstChild("RightHand")
- if RightArm then
- local Grip = RightArm:WaitForChild("RightGrip",0.01)
- if Grip then
- Grip2 = Grip:Clone()
- Grip2.Name = "LeftGrip"
- Grip2.Part0 = LeftArm
- Grip2.Part1 = Handle2
- --Grip2.C1 = Grip2.C1:inverse()
- Grip2.Parent = LeftArm
- end
- end
- end
- local StartTime = os.clock() repeat Thread:Wait() if not Variables.Equipped then break end until (os.clock() - StartTime) >= Module.EquipTime
- if Variables.Equipped then
- Variables.ActuallyEquipped = true
- end
- if Variables.ActuallyEquipped and Module.AutoReload and not Variables.Reloading and (Variables.Ammo > 0 or not Module.LimitedAmmoEnabled) and Variables.Mag <= 0 then
- Reload()
- end
- end)
- Tool.Unequipped:Connect(function()
- OnUnequipping()
- end)
- Humanoid.Died:Connect(function()
- OnUnequipping()
- end)
- Tool.AncestryChanged:Connect(function()
- if not Tool:IsDescendantOf(game) then
- OnUnequipping()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment