Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --SynapseX Decompiler
- script:WaitForChild("ToolName")
- ToolName = script.ToolName.Value
- ToolData = require(game.ReplicatedStorage.ToolData[ToolName])
- HandlerData = require(game.ReplicatedStorage.HandlerData[script.Name])
- EaseJoint = require(game.ReplicatedStorage.CustomLibraries.CFrameEasing)
- Notification = require(game.ReplicatedStorage.CustomLibraries.Notifications)
- Maths = require(game.ReplicatedStorage.CustomLibraries.MathsMethods)
- BulletImpact = require(game.ReplicatedStorage.CustomLibraries.BulletImpacts)
- Player = game.Players.LocalPlayer
- Character = Player.Character
- Humanoid = Character.Humanoid
- ArmTorso = Character.ArmTorso
- Tool = Character[ToolName]
- Mouse = Player:GetMouse()
- EaseJoint.Halt(Player)
- local BulletLoaded = Player.Inventory[ToolName].BulletLoaded.Value
- BulletLoadedThread = coroutine.create(function()
- BulletLoaded = game.ReplicatedStorage.Requests.RequestInventoryVariable:InvokeServer(Tool, script, "BulletLoaded")
- end)
- coroutine.resume(BulletLoadedThread)
- local ReloadStage = Player.Inventory[ToolName].ReloadStage.Value
- ReloadStageThread = coroutine.create(function()
- ReloadStage = game.ReplicatedStorage.Requests.RequestInventoryVariable:InvokeServer(Tool, script, "ReloadStage")
- if ReloadStage == 2 then
- game.ReplicatedStorage.Requests.RequestCartridgeRemoval:InvokeServer(Tool, Character["Right Arm"], true)
- end
- end)
- coroutine.resume(ReloadStageThread)
- HaltAnimation = false
- Bracing = false
- Stance = "Equip"
- AnimationTimeCoefficient = ToolData.Properties.AnimationTimeCoefficient
- Bayonet = ToolData.Properties.Bayonet
- Brace = ToolData.Properties.Brace
- BulletMuzzleVelocity = ToolData.Properties.BulletMuzzleVelocity
- GravityVector = HandlerData.GravityVector
- BulletDrag = BulletMuzzleVelocity / HandlerData.BulletDragCoefficient
- BlockWalkSpeedReduction = HandlerData.BlockWalkSpeedReduction
- AccuracyBuffCoefficient = 0.8
- ReloadSpeedBuffCoefficient = 0.85
- MeleeSpeedBuffCoefficient = 0.85
- Mouse.TargetFilter = Character
- Mouse.Icon = HandlerData.MouseIcon
- LastReplicate = tick()
- ReplicateDelay = 0.03333333333333333
- Mouse.Move:connect(function()
- local YAxis = Mouse.UnitRay.Direction.Y
- local Angle = math.asin(YAxis)
- if Character.Torso:FindFirstChild("Neck") then
- Character.Torso.Neck.C1 = CFrame.new(0, -0.5, 0) * CFrame.Angles(math.rad(-90) - Angle, 0, math.rad(180))
- if tick() > LastReplicate + ReplicateDelay then
- game.ReplicatedStorage.SelectiveReplication.UpdateObject:FireServer(Character.Torso.Neck, "C1", CFrame.new(0, -0.5, 0) * CFrame.Angles(math.rad(-90) - Angle, 0, math.rad(180)))
- end
- end
- if not string.match(Stance, "Present") and not string.match(Stance, "Bayonet") or Bracing then
- Angle = 0
- elseif string.match(Stance, "Bayonet") and math.abs(Angle) > math.rad(20) then
- if Angle > math.rad(20) then
- Angle = math.rad(20)
- else
- Angle = math.rad(-20)
- end
- end
- if Character.Torso:FindFirstChild("TorsoJoint") then
- Character.Torso.TorsoJoint.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(-Angle, 0, 0)
- if tick() > LastReplicate + ReplicateDelay then
- LastReplicate = tick()
- game.ReplicatedStorage.SelectiveReplication.UpdateObject:FireServer(Character.Torso.TorsoJoint, "C1", CFrame.new(0, 0, 0) * CFrame.Angles(-Angle, 0, 0))
- end
- end
- local MouseTarget = Mouse.Target
- if MouseTarget then
- if game.Players:FindFirstChild(MouseTarget.Parent.Name) and Player.TeamColor == game.Players[MouseTarget.Parent.Name].TeamColor then
- Mouse.Icon = HandlerData.FriendlyMouseIcon
- elseif game.Players:FindFirstChild(MouseTarget.Parent.Parent.Name) and Player.TeamColor == game.Players[MouseTarget.Parent.Parent.Name].TeamColor then
- Mouse.Icon = HandlerData.FriendlyMouseIcon
- elseif MouseTarget.Parent.Parent:FindFirstChild("HorseHumanoid") and Player.TeamColor == MouseTarget.Parent.Parent.HorseHumanoid.Team.Value then
- Mouse.Icon = HandlerData.FriendlyMouseIcon
- else
- Mouse.Icon = HandlerData.MouseIcon
- end
- end
- end)
- function DetermineWalkSpeed(QuieredStance, IgnoreCrouching)
- local WalkSpeed = ToolData.Properties.DefaultWalkSpeed
- if Character.HumanoidRootPart.RootJoint.C1 ~= CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0) and not IgnoreCrouching then
- WalkSpeed = 0
- elseif string.match(QuieredStance, "Present") then
- WalkSpeed = ToolData.Properties.PresentWalkSpeed
- elseif string.match(QuieredStance, "MakeReady") then
- WalkSpeed = ToolData.Properties.MakeReadyWalkSpeed
- elseif string.match(QuieredStance, "Block") then
- WalkSpeed = ToolData.Properties.BayonetWalkSpeed - BlockWalkSpeedReduction
- elseif string.match(QuieredStance, "Bayonet") then
- WalkSpeed = ToolData.Properties.BayonetWalkSpeed
- elseif string.match(QuieredStance, "Reload") then
- WalkSpeed = ToolData.Properties.ReloadWalkSpeed
- end
- return WalkSpeed
- end
- function DetermineAutoRotate(QuieredStance)
- return not string.match(QuieredStance, "Reload") or string.match(QuieredStance, "ReloadRecover") or DetermineWalkSpeed(QuieredStance, true) ~= 0 or Bracing
- end
- function DetermineAccuracyBuffCoefficient()
- for _, Status in pairs(Player.PlayerGui.Backpack.StatusControl.RequestStatuses:Invoke()) do
- if Status.Name == "OfficerAccuracy" and Status.GivenByServer then
- return AccuracyBuffCoefficient
- end
- end
- return 1
- end
- function DetermineAnimationSpeedBuffCoefficient()
- for _, Status in pairs(Player.PlayerGui.Backpack.StatusControl.RequestStatuses:Invoke()) do
- if Status.Name == "MusicianReloadSpeed" and Status.GivenByServer and string.match(Stance, "Reload") then
- return ReloadSpeedBuffCoefficient
- elseif Status.Name == "ColourMeleeSpeed" and Status.GivenByServer and string.match(Stance, "Bayonet") then
- return MeleeSpeedBuffCoefficient
- end
- end
- return 1
- end
- function BulletFire()
- local InitialVector = (Mouse.Hit.p - Tool.Muzzle.Position).unit + BulletCalculateDeviation().unit
- local AimVector = Character.Head.CFrame.lookVector
- if (InitialVector - AimVector).magnitude > ToolData.Properties.BulletInitialVectorTolerance then
- InitialVector = AimVector
- end
- local NewBullet = BulletInitialise()
- NewBullet.Parent, NewBullet.CFrame = workspace, CFrame.new(Tool.Muzzle.Position, Tool.Muzzle.Position + InitialVector)
- local BulletThread = coroutine.create(function()
- BulletTravel(NewBullet, InitialVector, BulletMuzzleVelocity, nil)
- end)
- coroutine.resume(BulletThread)
- local EffectThread = coroutine.create(function()
- PlayEffect("BulletFire")
- end)
- coroutine.resume(EffectThread)
- game.ReplicatedStorage.Requests.RequestBulletLoadedUpdate:FireServer(Player.Inventory[Tool.Name])
- end
- function BulletInitialise()
- local NewBullet = Instance.new("Part")
- NewBullet.Name = "Bullet"
- NewBullet.Anchored, NewBullet.CanCollide = true, false
- NewBullet.BrickColor, NewBullet.Material = BrickColor.White(), Enum.Material.Neon
- NewBullet.formFactor = Enum.FormFactor.Custom
- NewBullet.Size = Vector3.new(0.2, 0.2, 0.2)
- Instance.new("BlockMesh", NewBullet).Scale = Vector3.new(0.5, 0.5, 40)
- NewBullet.Mesh.Offset = Vector3.new(0, 0, -5)
- game.ReplicatedStorage.SelectiveReplication.PlayerDied.OnClientEvent:connect(function()
- if NewBullet then
- NewBullet:Destroy()
- end
- end)
- game:GetService("Debris"):AddItem(NewBullet)
- return NewBullet
- end
- function BulletTravel(Bullet, BulletVector, BulletVelocity, PreviousHit)
- local BulletRay = Ray.new(Bullet.Position, BulletVector * BulletVelocity)
- local Hit, HitPos = workspace:FindPartOnRayWithIgnoreList(BulletRay, {Tool, PreviousHit})
- game.ReplicatedStorage.Requests.RequestBulletCrack:FireServer(Tool, BulletRay)
- if Hit and Hit.Transparency ~= 1 then
- BulletHit(Hit, HitPos, BulletVector)
- Bullet:Destroy()
- else
- Bullet.CFrame = CFrame.new(HitPos, HitPos + BulletVector)
- wait(0.03333333333333333)
- if BulletVelocity > 0 then
- BulletTravel(Bullet, BulletVector.unit, BulletVelocity - BulletDrag, Hit)
- else
- Bullet:Destroy()
- end
- end
- end
- function BulletHit(Hit, HitPos, BulletVector)
- if Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent:FindFirstChild("HumanoidLink") then
- game.ReplicatedStorage.Requests.RequestDamage:FireServer(Hit, HitPos, Tool, "Bullet")
- elseif Hit.Parent:FindFirstChild("HorseHumanoid") or Hit.Parent.Parent:FindFirstChild("HorseHumanoid") then
- game.ReplicatedStorage.Requests.RequestDamage:FireServer(Hit.Parent:FindFirstChild("HorseCentre") or Hit.Parent.Parent:FindFirstChild("HorseCentre"), Tool.Handle.Position, Tool, "Bullet")
- elseif Hit.Parent:FindFirstChild("ConstructCentre") then
- game.ReplicatedStorage.Requests.RequestDamage:FireServer(Hit.Parent.ConstructCentre, Tool.Handle.Position, Tool, "Bullet")
- end
- BulletImpact.new(Hit, HitPos, BulletVector)
- game.ReplicatedStorage.SelectiveReplication.InstanciateBulletImpact:FireServer(Tool, script, Hit, HitPos, BulletVector)
- end
- function BulletCalculateDeviation()
- local MaximumDeviation = ToolData.Properties.BulletMaximumDeviation
- local function CalculateDeviation()
- return math.random(-10000 * MaximumDeviation, 10000 * MaximumDeviation) / 10000 * DetermineAccuracyBuffCoefficient()
- end
- return Vector3.new(CalculateDeviation(), CalculateDeviation(), CalculateDeviation())
- end
- function IsInFirstPerson()
- return (Character.Head.Position - workspace.CurrentCamera.CoordinateFrame.p).magnitude <= 1.2
- end
- script:WaitForChild("RequestStance")
- function script.RequestStance.OnClientInvoke()
- return Stance
- end
- script:WaitForChild("RequestBulletLoaded")
- function script.RequestBulletLoaded.OnClientInvoke()
- return BulletLoaded
- end
- script:WaitForChild("RequestReloadStage")
- function script.RequestReloadStage.OnClientInvoke()
- return ReloadStage
- end
- function PlayEffect(EffectName)
- local Effect = ToolData.Effects[EffectName]
- for _, Stage in pairs(Effect) do
- for _, Element in pairs(Stage) do
- if Element.SoundName then
- Tool[Element.SoundParent][Element.SoundName]:Play()
- elseif Element.EffectName then
- Tool[Element.EffectParent][Element.EffectName].Enabled = Element.EffectValue
- game.ReplicatedStorage.SelectiveReplication.UpdateObject:FireServer(Tool[Element.EffectParent][Element.EffectName], "Enabled", Element.EffectValue)
- elseif Element.FlashParent then
- Tool[Element.FlashParent].Flash.Flash.Visible = Element.FlashValue
- game.ReplicatedStorage.SelectiveReplication.UpdateObject:FireServer(Tool[Element.FlashParent].Flash.Flash, "Visible", Element.FlashValue)
- elseif Element.Wait then
- wait(Element.Wait)
- end
- end
- end
- end
- function PlayAnimation(StartStance, EndStance, ImmuneToHalt)
- if HaltAnimation and not ImmuneToHalt then
- return
- end
- local Animation = ToolData.Animations[StartStance .. "To" .. EndStance]
- game.ReplicatedStorage.SelectiveReplication.ReplicateAnimation:FireServer("Tool", ToolName, StartStance .. "To" .. EndStance)
- Stance = StartStance .. "Moving"
- Humanoid.WalkSpeed = math.min(DetermineWalkSpeed(StartStance), DetermineWalkSpeed(EndStance))
- Humanoid.AutoRotate = DetermineAutoRotate(StartStance) and DetermineAutoRotate(EndStance)
- for _, KeyFrame in pairs(Animation) do
- for _, Transition in pairs(KeyFrame) do
- if Transition.JointName then
- if Transition.C0 then
- local TransitionThread = coroutine.create(function()
- EaseJoint[Transition.Style](ArmTorso[Transition.JointName], "C0", ArmTorso[Transition.JointName].C0, Transition.C0 * CFrame.new(0, 1.5, 0), Transition.Duration * AnimationTimeCoefficient * DetermineAnimationSpeedBuffCoefficient())
- end)
- coroutine.resume(TransitionThread)
- end
- if Transition.C1 then
- local TransitionThread = coroutine.create(function()
- EaseJoint[Transition.Style](ArmTorso[Transition.JointName], "C1", ArmTorso[Transition.JointName].C1, Transition.C1 * CFrame.new(0, 1.5, 0), Transition.Duration * AnimationTimeCoefficient * DetermineAnimationSpeedBuffCoefficient())
- end)
- coroutine.resume(TransitionThread)
- end
- elseif Transition.RotationName then
- if Transition.C0 then
- local TransitionThread = coroutine.create(function()
- EaseJoint[Transition.Style](Tool[Transition.RotationName].RotationJoint, "C0", Tool[Transition.RotationName].RotationJoint.C0, Transition.C0, Transition.Duration * AnimationTimeCoefficient * DetermineAnimationSpeedBuffCoefficient())
- end)
- coroutine.resume(TransitionThread)
- end
- if Transition.C1 then
- local TransitionThread = coroutine.create(function()
- EaseJoint[Transition.Style](Tool[Transition.RotationName].RotationJoint, "C1", Tool[Transition.RotationName].RotationJoint.C1, Transition.C1, Transition.Duration * AnimationTimeCoefficient * DetermineAnimationSpeedBuffCoefficient())
- end)
- coroutine.resume(TransitionThread)
- end
- elseif Transition.TorsoAngle then
- local TransitionThread = coroutine.create(function()
- EaseJoint[Transition.Style](Character.HumanoidRootPart.RootJoint, "C0", Character.HumanoidRootPart.RootJoint.C0, CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0) * CFrame.Angles(0, 0, Transition.TorsoAngle), Transition.Duration * AnimationTimeCoefficient * DetermineAnimationSpeedBuffCoefficient())
- end)
- coroutine.resume(TransitionThread)
- local TransitionThread = coroutine.create(function()
- EaseJoint[Transition.Style](Character.Torso.TorsoJoint, "C0", Character.Torso.TorsoJoint.C0, CFrame.new(0, 1.5, 0) * CFrame.Angles(0, -Transition.TorsoAngle, 0), Transition.Duration * AnimationTimeCoefficient * DetermineAnimationSpeedBuffCoefficient())
- end)
- coroutine.resume(TransitionThread)
- local TransitionThread = coroutine.create(function()
- EaseJoint[Transition.Style](Character.Torso.Neck, "C0", Character.Torso.Neck.C0, CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(-90), 0, math.rad(180) - Transition.TorsoAngle), Transition.Duration * AnimationTimeCoefficient * DetermineAnimationSpeedBuffCoefficient())
- end)
- coroutine.resume(TransitionThread)
- elseif Transition.SoundName then
- Tool[Transition.SoundParent][Transition.SoundName]:Play()
- elseif Transition.Cartridge ~= nil then
- if Transition.Cartridge and not Transition.SeparateThread then
- game.ReplicatedStorage.Requests.RequestCartridge:InvokeServer(Tool, Character["Right Arm"], true)
- elseif not Transition.Cartridge and not Transition.SeparateThread then
- game.ReplicatedStorage.Requests.RequestCartridgeRemoval:InvokeServer(Tool, Character["Right Arm"], true)
- elseif not Transition.Cartridge and Transition.SeparateThread and Transition.CartridgeModifyModel then
- local CartridgeThread = coroutine.create(function()
- game.ReplicatedStorage.Requests.RequestCartridgeRemoval:InvokeServer(Tool, Character["Right Arm"], true)
- end)
- coroutine.resume(CartridgeThread)
- elseif not Transition.Cartridge and Transition.SeparateThread and not Transition.CartridgeModifyModel then
- local CartridgeThread = coroutine.create(function()
- game.ReplicatedStorage.Requests.RequestCartridgeRemoval:InvokeServer(Tool, Character["Right Arm"], false)
- end)
- coroutine.resume(CartridgeThread)
- end
- elseif Transition.Wait then
- for SplitWait = 1, 4 do
- if not ImmuneToHalt and HaltAnimation then
- return
- end
- Humanoid.WalkSpeed = math.min(DetermineWalkSpeed(StartStance), DetermineWalkSpeed(EndStance))
- wait(0.25 * Transition.Wait * AnimationTimeCoefficient * DetermineAnimationSpeedBuffCoefficient())
- end
- elseif not ImmuneToHalt and HaltAnimation then
- return
- end
- end
- if not ImmuneToHalt and HaltAnimation then
- return
- end
- end
- if not ImmuneToHalt and HaltAnimation then
- return
- end
- Stance = EndStance
- Humanoid.WalkSpeed = DetermineWalkSpeed(EndStance)
- Humanoid.AutoRotate = DetermineAutoRotate(EndStance)
- end
- game.ReplicatedStorage.SelectiveReplication.PlayerDied.OnClientEvent:connect(function()
- Stance = "Dead"
- EaseJoint.Halt(Player)
- end)
- function FailSafe()
- if not script.Parent then
- warn(script.Name .. " fail-safe fired for: " .. ToolName .. ", owned by: " .. Player.Name .. ".")
- game:GetService("Debris"):AddItem(script, 1)
- script.Disabled = true
- end
- end
- FailSafe()
- script.Changed:connect(FailSafe)
- Mouse.Button1Down:connect(function()
- if BulletLoaded and Stance == "Shoulder" then
- PlayAnimation(Stance, "MakeReady")
- elseif BulletLoaded and Stance == "MakeReady" then
- PlayAnimation(Stance, "Shoulder")
- elseif BulletLoaded and Stance == "PresentUnready" then
- PlayAnimation(Stance, "PresentReady")
- elseif BulletLoaded and Stance == "PresentReady" then
- PlayAnimation(Stance, "PresentFire")
- BulletFire()
- BulletLoaded = false
- Player.PlayerScripts.CameraScript.AlterMouseSensitivity:Fire(1)
- PlayAnimation(Stance, "ReloadRecover")
- elseif Bayonet and not Bracing and Stance == "Bayonet" then
- PlayAnimation(Stance, "BayonetReady")
- Notification.WaitFor(script, "BayonetReady")
- PlayAnimation(Stance, "BayonetThrustOut")
- PlayAnimation(Stance, "BayonetThrustIn")
- PlayAnimation(Stance, "Bayonet")
- Notification.Give(script, "BayonetFinished", 0.1)
- if Brace then
- Bracing = Character.Crouching.Enabled.Value
- Humanoid.AutoRotate = not Character.Crouching.Enabled.Value
- end
- elseif not BulletLoaded and Stance == "ReloadRecover" then
- PlayAnimation(Stance, "ReloadStage1")
- PlayAnimation(Stance, "ReloadStage2")
- if not HaltAnimation then
- ReloadStage = 2
- end
- PlayAnimation(Stance, "ShoulderRecoverVariant0")
- PlayAnimation(Stance, "Shoulder")
- if not HaltAnimation then
- BulletLoaded = true
- ReloadStage = 1
- end
- end
- end)
- Mouse.Button2Down:connect(function()
- if IsInFirstPerson() and Stance == "Shoulder" then
- PlayAnimation(Stance, "PresentUnready")
- Player.PlayerScripts.CameraScript.AlterMouseSensitivity:Fire(0.5)
- elseif IsInFirstPerson() and BulletLoaded and Stance == "MakeReady" then
- PlayAnimation(Stance, "PresentReady")
- Player.PlayerScripts.CameraScript.AlterMouseSensitivity:Fire(0.5)
- elseif IsInFirstPerson() and Stance == "PresentReady" then
- PlayAnimation(Stance, "Shoulder")
- Player.PlayerScripts.CameraScript.AlterMouseSensitivity:Fire(1)
- elseif IsInFirstPerson() and Stance == "PresentUnready" then
- PlayAnimation(Stance, "Shoulder")
- Player.PlayerScripts.CameraScript.AlterMouseSensitivity:Fire(1)
- elseif Bayonet and not Bracing and Stance == "Bayonet" then
- game.ReplicatedStorage.Requests.RequestToolBlockToggle:FireServer(Tool, script, true)
- PlayAnimation(Stance, "BayonetBlock")
- Notification.WaitFor(script, "BayonetStopBlocking")
- game.ReplicatedStorage.Requests.RequestToolBlockToggle:FireServer(Tool, script, false)
- PlayAnimation(Stance, "Bayonet")
- if Brace then
- Bracing = Character.Crouching.Enabled.Value
- Humanoid.AutoRotate = not Character.Crouching.Enabled.Value
- end
- elseif Stance == "ReloadRecover" then
- PlayAnimation(Stance, "ShoulderRecover")
- PlayAnimation(Stance, "Shoulder")
- end
- end)
- Mouse.Button1Up:connect(function()
- if Bayonet and (Stance == "BayonetMoving" or Stance == "BayonetReady") then
- Notification.Give(script, "BayonetReady")
- end
- end)
- Mouse.Button2Up:connect(function()
- if Bayonet and (Stance == "BayonetMoving" or Stance == "BayonetBlock") then
- Notification.Give(script, "BayonetStopBlocking")
- end
- end)
- Mouse.KeyDown:connect(function(Key)
- Key = string.upper(Key)
- if DetermineWalkSpeed(Stance) == 0 and Character.Crouching.Enabled.Value and string.match("WASD\017\018", Key) then
- Notification.WaitForExternal(Character.Crouching, "CrouchStarted")
- Humanoid.WalkSpeed = DetermineWalkSpeed(Stance)
- wait(0.1)
- Notification.WaitForExternal(Character.Crouching, "CrouchFinished")
- Humanoid.WalkSpeed = DetermineWalkSpeed(Stance)
- if Bayonet and Brace and Stance == "Bayonet" then
- Bracing = false
- Humanoid.AutoRotate = true
- end
- end
- if DetermineWalkSpeed(Stance, true) == 0 and string.match("WASD\017\018", Key) and BulletLoaded and Stance == "MakeReady" then
- PlayAnimation(Stance, "Shoulder")
- Player.PlayerScripts.CameraScript.AlterMouseSensitivity:Fire(1)
- elseif DetermineWalkSpeed(Stance, true) == 0 and string.match("WASD\017\018", Key) and Stance == "PresentReady" then
- PlayAnimation(Stance, "Shoulder")
- Player.PlayerScripts.CameraScript.AlterMouseSensitivity:Fire(1)
- elseif DetermineWalkSpeed(Stance, true) == 0 and string.match("WASD\017\018", Key) and Stance == "PresentUnready" then
- PlayAnimation(Stance, "Shoulder")
- Player.PlayerScripts.CameraScript.AlterMouseSensitivity:Fire(1)
- elseif DetermineWalkSpeed(Stance, true) == 0 and string.match("WASD\017\018", Key) and Stance == "ReloadRecover" then
- PlayAnimation(Stance, "ShoulderRecover")
- PlayAnimation(Stance, "Shoulder")
- elseif DetermineWalkSpeed("Reload", true) == 0 and string.match("WASD\017\018", Key) and Stance == "ReloadStage1Moving" and not HaltAnimation then
- HaltAnimation = true
- EaseJoint.Halt(Player)
- PlayAnimation(Stance, "ShoulderRecoverVariant1", true)
- PlayAnimation(Stance, "Shoulder", true)
- HaltAnimation = false
- elseif DetermineWalkSpeed("Reload", true) == 0 and string.match("WASD\017\018", Key) and Stance == "ReloadStage2Moving" and not HaltAnimation then
- HaltAnimation = true
- EaseJoint.Halt(Player)
- PlayAnimation(Stance, "ShoulderRecoverVariant2", true)
- PlayAnimation(Stance, "Shoulder", true)
- HaltAnimation = false
- elseif Key == "R" and not BulletLoaded and ReloadStage == 1 and Stance == "Shoulder" then
- PlayAnimation(Stance, "ReloadRecover")
- PlayAnimation(Stance, "ReloadStage1")
- PlayAnimation(Stance, "ReloadStage2")
- if not HaltAnimation then
- ReloadStage = 2
- end
- PlayAnimation(Stance, "ShoulderRecoverVariant0")
- PlayAnimation(Stance, "Shoulder")
- if not HaltAnimation then
- BulletLoaded = true
- ReloadStage = 1
- end
- elseif Key == "R" and not BulletLoaded and ReloadStage == 2 and Stance == "Shoulder" then
- PlayAnimation(Stance, "ReloadRecover")
- PlayAnimation(Stance, "ReloadStage2")
- PlayAnimation(Stance, "ShoulderRecoverVariant0")
- PlayAnimation(Stance, "Shoulder")
- if not HaltAnimation then
- BulletLoaded = true
- ReloadStage = 1
- end
- elseif Key == "R" and not BulletLoaded and ReloadStage == 1 and Stance == "ReloadRecover" then
- PlayAnimation(Stance, "ReloadStage1")
- PlayAnimation(Stance, "ReloadStage2")
- if not HaltAnimation then
- ReloadStage = 2
- end
- PlayAnimation(Stance, "ShoulderRecoverVariant0")
- PlayAnimation(Stance, "Shoulder")
- if not HaltAnimation then
- BulletLoaded = true
- ReloadStage = 1
- end
- elseif Key == "R" and not BulletLoaded and ReloadStage == 2 and Stance == "ReloadRecover" then
- PlayAnimation(Stance, "ReloadStage2")
- PlayAnimation(Stance, "Shoulder")
- if not HaltAnimation then
- BulletLoaded = true
- ReloadStage = 1
- end
- elseif Bayonet and Key == "X" and Stance == "Shoulder" then
- PlayAnimation(Stance, "Bayonet")
- if Brace then
- Bracing = Character.Crouching.Enabled.Value
- Humanoid.AutoRotate = not Character.Crouching.Enabled.Value
- end
- elseif Bayonet and Key == "X" and Stance == "ReloadRecover" then
- PlayAnimation(Stance, "Bayonet")
- if Brace then
- Bracing = Character.Crouching.Enabled.Value
- Humanoid.AutoRotate = not Character.Crouching.Enabled.Value
- end
- elseif Bayonet and Key == "X" and Stance == "Bayonet" then
- PlayAnimation(Stance, "Shoulder")
- if Brace and Bracing then
- Bracing = false
- Humanoid.AutoRotate = true
- end
- elseif Key == "C" then
- Notification.WaitForExternal(Character.Crouching, "CrouchStarted")
- Humanoid.WalkSpeed = DetermineWalkSpeed(Stance)
- wait(0.1)
- Notification.WaitForExternal(Character.Crouching, "CrouchFinished")
- Humanoid.WalkSpeed = DetermineWalkSpeed(Stance)
- if Bayonet and Brace and Stance == "Bayonet" then
- Bracing = Character.Crouching.Enabled.Value
- Humanoid.AutoRotate = not Character.Crouching.Enabled.Value
- end
- end
- end)
- if Bayonet then
- do
- local BayonetDebounce = false
- Tool.BayonetHitBox.Touched:connect(function(Hit)
- if string.match(Stance, "BayonetThrustOut") and Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") and not BayonetDebounce then
- BayonetDebounce = true
- local Blocked = false
- local OtherHandle = Hit.Parent:FindFirstChild("Handle", true)
- if OtherHandle and game.Players:FindFirstChild(Hit.Parent.Name) and OtherHandle.Parent:IsA("Model") and game.Players[Hit.Parent.Name].Inventory[OtherHandle.Parent.Name]:FindFirstChild("Blocking") and game.Players[Hit.Parent.Name].Inventory[OtherHandle.Parent.Name].Blocking.Value and not (math.rad(180) - Maths.AngleBetweenTwoParts(Character.Torso, Hit.Parent.Torso) >= math.rad(90)) then
- Blocked = true
- end
- if not Blocked then
- Tool.BayonetHitBox.HitFlesh:Play()
- game.ReplicatedStorage.Requests.RequestDamage:FireServer(Hit, Tool.BayonetHitBox.Position, Tool, "Melee")
- else
- OtherHandle.Block:Play()
- end
- Notification.WaitFor(script, "BayonetFinished")
- BayonetDebounce = false
- elseif string.match(Stance, "BayonetThrustOut") and Hit.Parent and (Hit.Parent:FindFirstChild("HorseHumanoid") or Hit.Parent.Parent:FindFirstChild("HorseHumanoid")) and not BayonetDebounce then
- BayonetDebounce = true
- Tool.BayonetHitBox.HitFlesh:Play()
- game.ReplicatedStorage.Requests.RequestDamage:FireServer(Hit.Parent:FindFirstChild("HorseCentre") or Hit.Parent.Parent:FindFirstChild("HorseCentre"), Tool.Handle.Position, Tool, "Melee")
- Notification.WaitFor(script, "BayonetFinished")
- BayonetDebounce = false
- elseif string.match(Stance, "BayonetThrustOut") and Hit.Parent and Hit.Parent:FindFirstChild("Integrity") and Hit.Parent:FindFirstChild("ConstructCentre") and not BayonetDebounce then
- BayonetDebounce = true
- Tool.BayonetHitBox.HitConstruct:Play()
- game.ReplicatedStorage.Requests.RequestDamage:FireServer(Hit.Parent.ConstructCentre, Tool.Handle.Position, Tool, "Melee")
- Notification.WaitFor(script, "BayonetFinished")
- BayonetDebounce = false
- elseif Brace and Bracing and Hit.Parent and (Hit.Parent:FindFirstChild("HorseHumanoid") or Hit.Parent.Parent:FindFirstChild("HorseHumanoid")) and not BayonetDebounce then
- BayonetDebounce = true
- Tool.BayonetHitBox.HitFlesh:Play()
- game.ReplicatedStorage.Requests.RequestDamage:FireServer(Hit.Parent:FindFirstChild("HorseCentre") or Hit.Parent.Parent:FindFirstChild("HorseCentre"), Tool.Handle.Position, Tool, "Melee")
- BayonetDebounce = false
- end
- end)
- end
- end
- wait()
- PlayAnimation(Stance, "Shoulder")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement