Custom tool idle not working properly when equipped

So I have a custom animation script (local) inside the tool that changes the walk and idle animations when equipped and back to normal when unequipped.

local char = script.Parent
local tool = char:FindFirstChild("Real Knife")

local function equip()
	local a:Weld = char:FindFirstChild("Right Arm"):WaitForChild("RightGrip")
	m6d = Instance.new("Motor6D")
	m6d.Parent = char:FindFirstChild("Right Arm")
	m6d.Name = "RightGrip"
	m6d.Part0 = a.Part0
	m6d.Part1 = a.Part1
	--m6d.C0 = a.C0
	--m6d.C1 = a.C1
	a:Destroy()



	local hum = char:FindFirstChild("Humanoid")
	oganim = char.Animate.toolnone.ToolNoneAnim.AnimationId
	oganim2 = char.Animate.idle.Animation1.AnimationId
	oganim3 = char.Animate.idle.Animation2.AnimationId
	char.Animate.toolnone.ToolNoneAnim.AnimationId = "rbxassetid://0"
	char.Animate.idle.Animation1.AnimationId = "rbxassetid://0"
	char.Animate.idle.Animation2.AnimationId = "rbxassetid://0"
	task.wait(0.1)
	anim = hum.Animator:LoadAnimation(tool.Idle)
	anim:Play()
	anim2 = hum.Animator:LoadAnimation(tool.walk)

	connector1 = hum.Changed:Connect(function(old, new)
		if hum.MoveDirection.Magnitude == 0 then
			if anim.IsPlaying == false then
				anim:Play(.25)
			end
			if anim2.IsPlaying == true then
				anim2:Stop(.25)
			end
		else
			if anim2.IsPlaying == false then
				anim2:Play(.25)
			end
			if anim.IsPlaying == true then
				anim:Stop(.25)
			end
		end
	end)

end

local function check()
	if tool.Parent ~= char then
		char.Animate.toolnone.ToolNoneAnim.AnimationId = oganim
		char.Animate.idle.Animation1.AnimationId = oganim2
		char.Animate.idle.Animation2.AnimationId = oganim3
		connector1:Disconnect()
		if anim.IsPlaying == true then
			anim:Stop()
		end
		if anim2.IsPlaying == true then
			anim2:Stop()
		end
		m6d:Destroy()
	end
end

tool:GetPropertyChangedSignal("Parent"):Connect(check)
tool.Equipped:Connect(equip)

The problem is when it gets equipped the idle doesn’t look “right” sometimes.
Video:

How i want it to look:
image

How it looks 50% of the time
image

2 Likes

Tried setting the weight and adding more wait()s, none worked unfortunately

1 Like

hey, not sure if you’re still having this problem but I also had this issue with the animations playing at half, the problem is you’re basically trying to play another animation OVER an already existing idle, causing them to “merge” for a lack of a better term. To fix this, I suggest basically replacing the ENTIRE “Animate” script all together. That worked for me at least.

I think Roblox swaps in and out tweening for r6 (kinda stupid but this happens to me)

hi yes! i’m still having this problem, what do you mean by replacing the animate script?

As in:

local CurrentAnims = game.players.localplayer.character.animate
local TargetAnims = game.replicatedstorage.anims:clone

and then just delete current anims and then parent TargetAnims to the character

wouldn’t that get rid of the default animations? I still want the animations to go back to normal once it’s unequipped

I can confirm from previous replies that you are running an animation BESIDES another running animation, therefore the Animate script tries to “blend” them together. To prevent this, here are multiple ways to approach.

I don’t remember if this works, but you can change the “animation id” in the Animate script. Then, whenever the tool unequips, you change it back to default.

Another way is to change the Priority of the animation (which I personally recommend). Roblox has 7 different animation priority, going from Core to Action4. You can set the priority of the animations to overlay the default animations, leaving only your animations visible.

Then just do the opposite, when equipping, destroy default and add your set, and when unequipped, put back default and remove your set

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.