I've made a sword tool, and the animation wont stop playing when the tool is unequipped or when i'm running/jumping/falling etc.
script.Parent.Equipped:Connect(function()
local Idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
local Equip = script.Parent.Parent.Humanoid:LoadAnimation(script.Equip)
local EquipSound = script.EquipSound
EquipSound:Play()
Equip:Play()
wait()
Idle:Play()
end)
script.Parent.Unequipped:Connect(function()
local Idle = script.Parent.Parent.Parent.Character.Humanoid:LoadAnimation(script.Idle)
local Equip = script.Parent.Parent.Parent.Character.Humanoid:LoadAnimation(script.Equip)
Idle:Stop()
Equip:Play()
script.Parent.Equip.Value = false
end)
script.Parent.Activated:Connect(function()
local Idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
local Attack = script.Parent.Attack
local AttackA = script.Parent.Parent.Humanoid:LoadAnimation(script.AttackA)
local AttackB = script.Parent.Parent.Humanoid:LoadAnimation(script.AttackB)
local AttackC = script.Parent.Parent.Humanoid:LoadAnimation(script.AttackC)
if Attack.Value == 1 and script.Parent.CanAttack.Value == true then
AttackA:Play()
Idle:Stop()
script.AttackSound:Play()
script.Parent.CanDamage.Value = true
script.Parent.CanAttack.Value = false
wait(0.5)
script.Parent.CanAttack.Value = true
Attack.Value = 2
Idle:Play()
script.Parent.CanDamage.Value = false
else if Attack.Value == 2 and script.Parent.CanAttack.Value == true then
AttackB:Play()
Idle:Stop()
script.AttackSound:Play()
script.Parent.CanDamage.Value = true
script.Parent.CanAttack.Value = false
wait(0.5)
script.Parent.CanAttack.Value = true
Attack.Value = 3
Idle:Play()
script.Parent.CanDamage.Value = false
else if Attack.Value == 3 and script.Parent.CanAttack.Value == true then
AttackC:Play()
Idle:Stop()
script.AttackSound:Play()
script.Parent.CanDamage.Value = true
script.Parent.CanAttack.Value = false
wait(0.5)
script.Parent.CanAttack.Value = true
Attack.Value = 1
Idle:Play()
script.Parent.CanDamage.Value = false
end
end
end
end)

1 comment
Thank you so much appreciated