How can I have animation 1 interrupt animation 2?
I have two animations. I have a gun hold animation, and a gun shoot animation. I'm trying to have the gun hold animation play, and then when the shoot animation is called, it plays over the hold animation.
I searched for solutions but honestly it's a tricky question to find the words for.
01 | local Players = game:GetService( "Players" ) |
02 | local gunequipped = false |
03 | local WeaponTool = script.Parent.Pistol |
04 | local player = Players.LocalPlayer |
06 | local character = player.Character |
07 | if not character or not character.Parent then |
08 | character = player.CharacterAdded:Wait() |
14 | local humanoid = character:WaitForChild( "Humanoid" ) |
15 | local animator = humanoid:WaitForChild( "Animator" ) |
20 | local HoldGunAnimation = Instance.new( "Animation" ) |
23 | local HoldGunAnimationTrack = animator:LoadAnimation(HoldGunAnimation) |
24 | HoldGunAnimationTrack.Priority = Enum.AnimationPriority.Action |
28 | local GlockShootAnimation = Instance.new( "Animation" ) |
31 | local GlockShootAnimationTrack = animator:LoadAnimation(HoldGunAnimation) |
32 | GlockShootAnimationTrack.Priority = Enum.AnimationPriority.Action |
42 | script.Parent.Equipped:Connect( function () |
45 | local M 6 D = Instance.new( "Motor6D" ) |
46 | M 6 D.Parent = char.UpperTorso |
50 | game.ReplicatedStorage.ConnectM 6 D:FireServer(WeaponTool.BodyAttach) |
51 | char.UpperTorso:FindFirstChild( "ToolGrip" ).Part 0 = char.UpperTorso |
52 | char.UpperTorso:FindFirstChild( "ToolGrip" ).Part 1 = WeaponTool.BodyAttach |
55 | HoldGunAnimationTrack:Play() |
63 | script.Parent.Unequipped:Connect( function () |
66 | game.ReplicatedStorage.DisconnectM 6 D:FireServer() |
68 | HoldGunAnimationTrack:Stop() |
76 | local be = script.Parent.Remotes:WaitForChild( "~~~~Event Name~~~" ) |
79 | local function AnimatorEvent(AnimType) |
81 | print ( "ANIMATION STARTING" ) |
82 | if AnimType = = "ShootAnim" then |
83 | HoldGunAnimationTrack:Stop() |
84 | GlockShootAnimationTrack:Play() |
85 | GlockShootAnimationTrack.Stopped:wait() |
86 | HoldGunAnimationTrack:Play() |
89 | be.Event:Connect(AnimatorEvent) |
Any insight would help! Thanks if you've read this far!