Script for idle & walking animation while tool equipped

Hello, I have a script that animates the character when a tool is equipped. The issue is that the idle animation overrides the walking animation. (Please don’t suggest not animating the legs, I need a custom stance) I tried using Heartbeat, but the walking animation looks weird with it (like it’s not fully playing roblox walking animation). Do you have any ideas on how I can fix this?

local HoldingTrack
tool.Equipped:Connect(function()
	local holdingAnimation = animator:LoadAnimation(tool.Animations.KatanaIdle)
	holdingAnimation:Play()
	HoldingTrack = holdingAnimation
end)

animationpriority, hope this helped

1 Like

have you thought of animationpriority?

Set the animation priority higher then the movement , I would suggest to set it at action

That won’t help, already tried it. Only holding tool animation playing and character just walking with holding animation

1 Like

if its the basic holding animation (right arm out), you have to remove the line in the base animate script (the one you get in your character on spawn) that plays the tool animation. specifically at line 415:

function animateTool() -- just remove this whole function

	if (toolAnim == "None") then
		playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle)
		return
	end

	if (toolAnim == "Slash") then
		playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)
		return
	end

	if (toolAnim == "Lunge") then
		playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)
		return
	end
end

then remove its reference at line 481

function move(time)
	local amplitude = 1
	local frequency = 1
	local deltaTime = time - lastTick
	lastTick = time

	local climbFudge = 0
	local setAngles = false

	if (jumpAnimTime > 0) then
		jumpAnimTime = jumpAnimTime - deltaTime
	end

	if (pose == "FreeFall" and jumpAnimTime <= 0) then
		playAnimation("fall", fallTransitionTime, Humanoid)
	elseif (pose == "Seated") then
		playAnimation("sit", 0.5, Humanoid)
		return
	elseif (pose == "Running") then
		playAnimation("walk", 0.1, Humanoid)
	elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
		--		print("Wha " .. pose)
		stopAllAnimations()
		amplitude = 0.1
		frequency = 1
		setAngles = true
	end

	if (setAngles) then
		local desiredAngle = amplitude * math.sin(time * frequency)

		RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
		LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
		RightHip:SetDesiredAngle(-desiredAngle)
		LeftHip:SetDesiredAngle(-desiredAngle)
	end

	-- Tool Animation handling
	local tool = getTool()
	if tool and tool:FindFirstChild("Handle") then

		local animStringValueObject = getToolAnim(tool)

		if animStringValueObject then
			toolAnim = animStringValueObject.Value
			-- message recieved, delete StringValue
			animStringValueObject.Parent = nil
			toolAnimTime = time + .3
		end

		if time > toolAnimTime then
			toolAnimTime = 0
			toolAnim = "None"
		end

		animateTool()	

and if you don’t want to go through this hassle, set the tool’s RequiresHandle property to false

1 Like