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.
local Players = game:GetService("Players")
local gunequipped = false
local WeaponTool = script.Parent.Pistol
local player = Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then
character = player.CharacterAdded:Wait()
end
local char = character
print(char.Name)
print(character.Name)
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
---------------- Pistol Hold anim -----------------------
local HoldGunAnimation = Instance.new("Animation")
-- Set its "AnimationId" to the corresponding animation asset ID
HoldGunAnimation.AnimationId = "rbxassetid://7225805475"
local HoldGunAnimationTrack = animator:LoadAnimation(HoldGunAnimation)
HoldGunAnimationTrack.Priority = Enum.AnimationPriority.Action
-----------------------------------------------------------------
---------------- Glock Shoot anim--------------------------
local GlockShootAnimation = Instance.new("Animation")
-- Set its "AnimationId" to the corresponding animation asset ID
GlockShootAnimation.AnimationId = "rbxassetid://7244252732"
local GlockShootAnimationTrack = animator:LoadAnimation(HoldGunAnimation)
GlockShootAnimationTrack.Priority = Enum.AnimationPriority.Action
-----------------------------------------------------------------
-------------------------------------------------------------------------------------------
script.Parent.Equipped:Connect(function()
gunequipped = true
shiftLock(true)
local M6D = Instance.new("Motor6D")
M6D.Parent = char.UpperTorso
print(M6D.Parent)
M6D.Name = "ToolGrip"
print(M6D.Name)
game.ReplicatedStorage.ConnectM6D:FireServer(WeaponTool.BodyAttach)
char.UpperTorso:FindFirstChild("ToolGrip").Part0 = char.UpperTorso
char.UpperTorso:FindFirstChild("ToolGrip").Part1 = WeaponTool.BodyAttach
HoldGunAnimationTrack:Play()
end)
script.Parent.Unequipped:Connect(function()
gunequipped = false
print("Unequipped")
game.ReplicatedStorage.DisconnectM6D:FireServer()
shiftLock(false)
HoldGunAnimationTrack:Stop()
end)
-- shoot anim --
local be = script.Parent.Remotes:WaitForChild("~~~~Event Name~~~")
local function AnimatorEvent(AnimType)
print(AnimType)
print("ANIMATION STARTING")
if AnimType == "ShootAnim" then
HoldGunAnimationTrack:Stop()
GlockShootAnimationTrack:Play()
GlockShootAnimationTrack.Stopped:wait()
HoldGunAnimationTrack:Play()
end
end
be.Event:Connect(AnimatorEvent)
Any insight would help! Thanks if you've read this far!

1 comment
You will need to use the animation priority. Try setting it to something higher like 'Action'.