I am trying to make a sword in my game, but it's animation is not playing for some reason, but other things are working, such as the opponent is being damaged by the sword, but the animation is not playing. Please tell me what is the problem with my script, and what actions I can take to fix it.
Here is the script:
local blade = script.Parent.Handle.Blade
local CanDamage = script.Parent.CanDamage
local CanAttack = true
local damage = 30
script.Parent.Equipped:Connect(function()
local human = script.Parent.Parent.Humanoid
local attack = human:LoadAnimation(script.Parent.Attack)
end)
script.Parent.Activated:Connect(function()
local human = script.Parent.Parent.Humanoid
if CanAttack == true then
local attack = human:LoadAnimation(script.Parent.Attack)
attack:Play()
CanAttack = false
CanDamage.Value = true
wait(1.3)
attack:Stop()
CanAttack = true
CanDamage.Value = false
end
end)
blade.Touched:Connect(function(hit)
local human = hit.Parent.Humanoid
if human then
if CanDamage.Value == true then
if human.Parent.Name ~= script.Parent.Parent.Name then
human:TakeDamage(damage)
end
end
end
end)
Thanks!

1 comment
i had same problem