I’m probably wrong but I’ll go and say that this code should work, but for whatever reason it doesn’t and I’ve ran out of options. I looked for solutions in this forum and still can’t figure out why this is happening.
Basically, my tool has an idle animation that is triggered when the tool is equipped.
-- anims
local anims = tool.Anims
local character
local humanoid
local animator
local unsheatheAnim = anims.Unsheathe
local idleAnim = anims.Idle
local attackAnim = anims.Attack
local attackAnim2 = anims.Attack2
local unsheatheAnimTrack
local idleAnimTrack
local attackAnimTrack
local attackAnimTrack2
function equipped()
if handle and tool.Parent then
character = tool.Parent
humanoid = character:WaitForChild("Humanoid")
-- anim tracks
animator = humanoid:WaitForChild("Animator")
unsheatheAnimTrack = animator:LoadAnimation(unsheatheAnim)
idleAnimTrack = animator:LoadAnimation(idleAnim)
attackAnimTrack = animator:LoadAnimation(attackAnim)
attackAnimTrack2 = animator:LoadAnimation(attackAnim2)
unsheatheAnimTrack:Play()
handle.Unsheathe:Play() -- this is a sound btw
idleAnimTrack:Play()
end
end
When it is unequipped, the animation is stopped in a similar manner it was started.
function unequipped()
if idleAnimTrack then
idleAnimTrack:Stop()
end
task.wait(0.1)
character = nil
humanoid = nil
animator = nil
canswing = true
combo = 0
end
Except it doesn’t. The animation continues playing when it should have stopped. There are no errors or anything in the output console. It just doesn’t stop. I have set up the table (supposedly) properly, and honestly, I don’t know what more I can do at this point. I would appreciate any help.