local CanAttack = true
script.Parent.Equipped:connect(function()
local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
local attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Attack)
idle:Play()
end)
script.Parent.Activated:connect(function()
local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
local attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Attack)
if CanAttack == true then
attack:Play()
idle:Stop()
wait(1)
attack:Stop()
idle:Play()
CanAttack = true
script.Parent.CanDamage.Value = true
end
end)
COMMUNITY QUESTION
Why is this sword animation not working in starterPlayer?
1 answer
It's most likely because every time you make a new animation, never stopping the original. Try doing something like this:
local CanAttack = true
local i = script:WaitForChild("Idle)
local a = script:WaitForChild("Attack")
local hum = script.Parent.Parent:WaitForChild("Humanoid")
i.Parent = hum
a.Parent = hum
local idle = hum:LoadAnimation(i)
local attack = hum:LoadAnimation(a)
script.Parent.Equipped:connect(function()
idle:Play()
end)
script.Parent.Activated:connect(function()
if CanAttack == true then
attack:Play()
idle:Stop()
wait(1)
attack:Stop()
idle:Play()
CanAttack = true
script.Parent.CanDamage.Value = true
end
end)
Also, another thing to note is that animations MUST be parented to the humanoid to work. This should fix all your problems.
Hope I could help. Have a nice day. -REALTimothy0812
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
it did not work