Having problems with my running animation + tool animation

I need help with my running animation every time I start running and activate my tool the animation of the tool has control over the torso’s rotation and it will override the running animation which looks weird and I can’t find a way to fix it, I’ve tried giving the running animation a priority of action2 and nothing the only solution was removing the torso frames from my tool animation, but it losses touch

I have seen Combat Warriors do this where you can run and still attack without this issue and I’m not sure if they rotate the torso by script or what is it.

Try setting the AnimationPriority to Walking (or Running), I forgot how it was called. :joy:

If that doesn’t work, try Idle.

Thank you for the advice, but unfortunately this won’t work because if the running animation has a higher priority than the tool animation it won’t execute because the running animation is in control of the arms and torso.

A solution to this problem I have found is to try do it by script by using lerp for a smooth rotation it looks a bit choppy but it does the work

Here are some video examples


Here is my script is someone has the same problem because I could not find a single video or person talking about it on how they can achieve it

local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local Debris = game:GetService("Debris")

local tool = script.Parent
local player = Players.LocalPlayer
local animation_folder = tool:WaitForChild("Animations_Folder")
local Idle = animation_folder:WaitForChild("Idle")
local Swing = animation_folder:WaitForChild("Swing")
local remote_folder = ReplicatedStorage:WaitForChild("ToolsEvents")
local SwingRemote = remote_folder:WaitForChild("ToolSwing")
local CancelSwing = remote_folder:WaitForChild("CancelSwing")

local markerConnections = {}
local LERP_SPEED = 0.05
local swingState = "None"
local baseTransform
local isSwinging = false
local isMouseDown = false
local idleTrack, swingTrack
local moveCheckConnection, holdConnection
local currentRotationCFrame = CFrame.new()


local function PerformSwing()
	if isSwinging then return end

	local character = player.Character
	local root = character and character:FindFirstChild("HumanoidRootPart")
	if not root then return end
	isSwinging = true


	SwingRemote:FireServer(tool)

	swingTrack:Play(0.1, 1, 1)

	swingTrack:GetMarkerReachedSignal("LandHit"):Once(function()
		SwingRemote:FireServer(tool, "StartHit")
	end)

	swingTrack:GetMarkerReachedSignal("EndHit"):Once(function()
		SwingRemote:FireServer(tool, "EndHit")
	end)

	local cooldown = tool:GetAttribute("SwingCooldown") or 0.5
	task.delay(cooldown, function()
		isSwinging = false
	end)
end

tool.Activated:Connect(PerformSwing)


local function Cleanup()
	isMouseDown = false
	isSwinging = false

	if idleTrack then idleTrack:Stop(0.1) end
	if swingTrack then swingTrack:Stop(0.1) end

	if moveCheckConnection then 
		moveCheckConnection:Disconnect() 
		moveCheckConnection = nil 
	end

	for _, conn in ipairs(markerConnections) do
		conn:Disconnect()
	end
	markerConnections = {}

	local character = player.Character
	if character then
		local root = character:FindFirstChild("HumanoidRootPart")
		if root then
			local rootJoint = root:FindFirstChild("RootJoint")
			if rootJoint then
				rootJoint.Transform = CFrame.new()
			end
		end
	end
end

local function LoadTracks(humanoid)
	local animator = humanoid:WaitForChild("Animator")

	if not idleTrack then idleTrack = animator:LoadAnimation(Idle) end
	if not swingTrack then swingTrack = animator:LoadAnimation(Swing) end

	idleTrack.Looped = true
	swingTrack.Priority = Enum.AnimationPriority.Action
end

tool.Equipped:Connect(function()
	local character = tool.Parent
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	local animator = humanoid:WaitForChild("Animator")
	local root = character:WaitForChild("HumanoidRootPart")
	local rootJoint = root:WaitForChild("RootJoint")
	baseTransform = rootJoint.Transform
	LoadTracks(humanoid)


	idleTrack:Play(0.1, 1, 1)

	table.insert(markerConnections,
		swingTrack:GetMarkerReachedSignal("Right"):Connect(function()
			swingState = "Right"
		end)
	)

	table.insert(markerConnections,
		swingTrack:GetMarkerReachedSignal("Left"):Connect(function()
			swingState = "Left"
		end)
	)

	table.insert(markerConnections,
		swingTrack:GetMarkerReachedSignal("End"):Connect(function()
			swingState = "None"
		end)
	)

	moveCheckConnection = RunService.Stepped:Connect(function()
		local targetAngle = 0

		if swingState == "Right" then
			targetAngle = math.rad(-25) 
		elseif swingState == "Left" then
			targetAngle = math.rad(25) 
		else
			targetAngle = 0 
		end

		local targetCFrame = CFrame.Angles(0, 0, targetAngle)
		currentRotationCFrame = currentRotationCFrame:Lerp(targetCFrame, LERP_SPEED)
		local baseTransform = rootJoint.Transform
		rootJoint.Transform = baseTransform * currentRotationCFrame
	end)
end)

UserInputService.InputBegan:Connect(function(input, gp)
	if gp then return end
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		isMouseDown = true
		if tool.Parent == player.Character then
			task.spawn(function()
				while isMouseDown do
					if not isSwinging then
						PerformSwing()
					end
					task.wait(tool:GetAttribute("SwingCooldown") or 0.5)
				end
			end)
		end
	end
end)

UserInputService.InputEnded:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		isMouseDown = false
	end
end)

tool.Unequipped:Connect(function()
	Cleanup()
	CancelSwing:FireServer()
end)