(Solved) Jump or Climb animation is overridden by Run animation

Hi you all. I’m currently trying to get first person animations to work, and I’m almost done. There is just one problem, the run animation overrides the jumping animation and the climbing animation, etc. I know how animation priorities work, but I’m not sure how to actually apply it to the default animations of r6. (I know there is an Animate Script that you start with, but I’m not sure how to make those animations have priority.) Also, I have the running animation set as movement priority because without it, it will blend with the jump animation, and other animations. I’ve tried finding tutorials and researching, and trying to modify the default animate script. I couldn’t really find anything.

Here is my existing sprint script if you need to view it (Local Script)

local Players = game:GetService('Players')
local UserInputService = game:GetService('UserInputService')

local Player = Players.LocalPlayer

local runAnimation = Instance.new("Animation")
runAnimation.AnimationId = "rbxassetid://16754777947"

local runAnimationTrack


UserInputService.InputBegan:Connect(function(InputObject: InputObject, gameProcessedEvent: boolean)
	if gameProcessedEvent == true then
		return
	end

	if InputObject.KeyCode == Enum.KeyCode.LeftShift then
		local Character = Player.Character

		if Character then
			local Humanoid: Humanoid = Character:WaitForChild('Humanoid')
			local animator: animator = Humanoid:WaitForChild("Animator")
			
			runAnimationTrack = animator:LoadAnimation(runAnimation)
			runAnimationTrack.Priority = Enum.AnimationPriority.Movement
			
			runAnimationTrack:Play()
			
		end
	end
end)

UserInputService.InputEnded:Connect(function(InputObject: InputObject, ...)
	if InputObject.KeyCode == Enum.KeyCode.LeftShift then
		local Character = Player.Character

		if Character then
			local Humanoid: Humanoid = Character:WaitForChild('Humanoid')

			runAnimationTrack:Stop()
		end
	end
end)

Thanks you all! :happy2:

Also the jump and climb animation is the default r6 animations, but the idle, walk, and run animations are made by me, which just replace the animation ID in the animate script(The sprint animation is handled separately by the sprint animation). Not sure if this makes a difference.

Never mind, I found a solution myself, after a lot more research

Could you please post the solution?

For anyone else who may have a similar problem, it’d be good to help them out in the future.

Alright, I added a new local script in StarterCharacterScripts:

local Humanoid = script.Parent:WaitForChild("Humanoid");

local animList = {
	"JumpAnim",
	"FallAnim",
	"ClimbAnim"
};

Humanoid.Animator.AnimationPlayed:Connect(function(AnimationTrack)
	if table.find(animList, AnimationTrack.Name) then
		AnimationTrack.Priority = Enum.AnimationPriority.Action;
	end
end

This is just the way to get the animations to have the AnimationPriority to what you want.

4 Likes