Tool equip animation not playing

Currently im trying to remake a sword i found in the toolbox. I made a equip animation but it isn’t playing the animation at all.

– Script
local parent = script.Parent
local Handle = parent:WaitForChild(“Handle”)
local Creator = parent:WaitForChild(“Creator”)
CanDmg = false
Can = true
damage = 25
cd = 0.7

parent.Equipped:Connect(function()
local creator = Creator.Value
local Animations = parent:WaitForChild(“Animations”)
local EquipWeapon = Animations.Equip
local EqTrack = creator:WaitForChild(“Humanoid”):LoadAnimation(EquipWeapon)
EqTrack:Play()
Handle.Equip:Play()
if Creator.Value == nil then
Creator.Value = parent.Parent end
end)

Blockquote

parent.Unequipped:Connect(function()
Handle.UnEquip:Play()
end)
repeat wait() until Creator.Value ~= nil
parent.Activated:Connect(function()
if Handle.Transparency == 1 then return end
function slash()
print(“hip”)
local creator = Creator.Value
local Animations = parent:WaitForChild(“Animations”)
local AnimChild = Animations:GetChildren()
local AnimRad = math.random(1,#AnimChild)
local AnimSel = AnimChild[AnimRad]
local AP = creator:WaitForChild(“Humanoid”):LoadAnimation(AnimSel)
if Can == true then
Can = false
AP:Play()
wait(0.15)
CanDmg = true
Handle.Swing:Play()
Handle.SlashTrail.Enabled = true
Handle.SlashTrail.Enabled = false
wait(cd)
CanDmg = false
Can = true
end
end
slash()
end)
function on(t)
local h = t.Parent:FindFirstChildOfClass(“Humanoid”)
if h ~= nil and CanDmg == true then
CanDmg = false
local cre = Creator.Value
h:TakeDamage(damage)
Handle.Swing:Stop()
Handle.Hit:Play()
if h.Health>0 then
if not h:FindFirstChild(“creator”) then
local ov = Instance.new(“ObjectValue”,h)
ov.Name = “creator”
ov.Value = game.Players:WaitForChild(cre.Name)
else
local ovs = h:GetChildren()
for i = 1,#ovs do
if (ovs[i].Name == “creator”) then
ovs[i].Value = game.Players:WaitForChild(cre.Name) end
end
end
end
end
end
Handle.Touched:Connect(on)

That’s a lot of scripting to wade through.
When you copy/paste any script here please type 3 backticks before and after the script to format it properly so we can read it.

From what I understand Animations are played from the client. Is this a server Script or a LocalScript?

A good check while troubleshooting is to print the variable(s) involved before any if statements like this:

    for i = 1,#ovs do
    print(ovs{i}.Name, "   ", creator)
    if (ovs[i].Name == “creator”) then
        -- code

Which will print both the items whether or not they are equal, but it’ll let you know when the if statement should fire.

It’s a server script. Will I have to use a local script or do I use a remote event?

I’m not a pro at animation, I’ve just read other posts about it.
Try the Search tool up top with terms like ‘animation won’t play’ or ‘tool animation not working’.

Alright. I was just confused since the attack animation worked