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.
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.