Problem with idle animation in my tool

Hello, thank you for visiting my forum and attempting to assist me!

Lately, I have been working with a melee system. The system is quite straightforward, but I have been dealing with weapon animation, and I have encountered the following issue. Here’s an image depicting the arrangement of the animations and the script within the tool.

image

There are three animations: attacking, equipping, and finally, the idle animation. My issue lies in the fact that I do not want to blend any of these animations. To explain this better, I’ve included an image of my script.

local tool = script.Parent
local handle = tool.Handle
enabled = true


tool.Equipped:Connect(function()
	local EquipAnim = script:FindFirstChild("Equip")
	local humanoid = script.Parent.Parent:FindFirstChild("Humanoid")
	local dance = humanoid:LoadAnimation(EquipAnim)
	local idleAnim = script:FindFirstChild("Idle")
	local dance1 = humanoid:LoadAnimation(idleAnim)
	dance:Play()
	handle.equip:Play()
	wait(0.7)
	dance1:Play() -- HERE IS MY IDLE ANIMATION
end)


local function heal()
	if enabled == false 
	then return end
	enabled = false
	local atackanimation = script:FindFirstChild('Attack')
	local humanoid = script.Parent.Parent:FindFirstChild("Humanoid")
	local dance = humanoid:LoadAnimation(atackanimation)
	dance:Play()
	handle.swing:Play()
	tool.Stab.Disabled = false
	task.wait(script.Parent.SwingDelay.Value)
	tool.Stab.Disabled = true
	enabled = true
end

tool.Activated:Connect(heal)

tool.Unequipped:Connect(function()
        -- (I DONT KNOW HOW TO MAKE THIS XD)
	-- HERE STOPPING THE IDLE ANIAMTION
	-- HERE STOPPING EQUIP ANIMATION
end)

As you can see, I want to trigger the equip animation when the tool is equipped and then, after a few seconds, transition to the idle animation. The challenge here is that I cannot place the locals outside the function as it ceases to work. Moreover, the idle animation must also be interrupted when the player initiates the attack animation. After the attack animation concludes, the idle animation should resume. However, how can I achieve this since they are not the same function? I have attempted this, but I have no idea how to proceed. At best, I managed to blend the animations, yielding a less-than-desirable outcome.

Any assistance is greatly appreciated! Thank you for your attention!

If you could provide me with a revised script that incorporates my requirements, it would greatly assist me in understanding the implementation better.

1 Like

hey dude I had the same problem as you, i dont think its the script. Go into animation editor click the 3 dots and change the animation from core to idle or action

Thanks, you helped me! :slight_smile: (One part) But i solved it

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