Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why isn't my sword equip animation working?

Asked by 1 year ago
Edited 1 year ago

my code:

local Tool = script.Parent
local Player = game:GetService('Players').LocalPlayer
local Character = Player.Character
if not Character or not Character.Parent then
    Character = Player.CharacterAdded:Wait()
end
local Humanoid = Character:WaitForChild('Humanoid')
local Animator = Humanoid:WaitForChild('Animator')

local EquipAnimation = Tool.Animations.Equip

local EquipAnimationTrack = Humanoid:LoadAnimation(EquipAnimation)
EquipAnimationTrack.Priority = Enum.AnimationPriority.Action
EquipAnimationTrack.Looped = false

Tool.Equipped:Connect(function()
    EquipAnimationTrack:Play()
end)

Tool.Unequipped:Connect(function()
    EquipAnimationTrack:Stop()
end)


it works in the animation editor but not when i test it. Can anybody help?

I have two keyframes if that helps. I also have a Motor6D attached to the hand.

0
My theory is that the animation was created without the tool. I'm not the best at animating so it's just a guess. I recommend looking up a tutorial mm1678YT 80 — 1y
0
I did use the tool during animation. It may be because I motor6ded it to the hand. xXmatthewgameingXx 2 — 1y
0
Could possibly be the fact you're trying to change the looped setting - last time I checked you couldn't do that via script, remove that and see what happens. Not the greatest animator but have animated tools before, code checks out besides that one thing so have a go. TabooAntonioiscool 42 — 1y

2 answers

Log in to vote
0
Answered by
Lakodex 711 Moderation Voter
1 year ago
Edited 1 year ago

Here are a few troubleshooting tips.

. Did you put a valid AnimationID (that you uploaded, or group uploaded) in the Animations.Equip?

. Is this script a Script? If not. Put it as a Localscript as you are trying to get localplayer.

. Check in output in View > Output.

Why I am putting this? It worked perfectly in game and it should with you as well. Have fun!

0
@Lakodex yea ive done all of that and it doesnt work xXmatthewgameingXx 2 — 1y
0
whats da Moderation claim for? Puppynniko 1059 — 1y
Ad
Log in to vote
0
Answered by 1 year ago

I found out it was because I used motor6ds! Thank you for your help!

0
No problem! I will be locking this thread. Lakodex 711 — 1y
0
you dont have to lock it always Puppynniko 1059 — 1y

Answer this question