It might be because you don’t own the animation, if you own it then I don’t know what else to tell you. But if you don’t make your own animation and see if it works from there.
Sorry, here it is:
It still needs the animator before loadanimation like sotr654 said before
What do you mean by that? Is it an instance or…
Animator is a child object of Humanoid the old Humanoid:LoadAnimation(Animation)
is depricated try Humanoid.Animator:LoadAnimation(Animation)
Animator (roblox.com)
So I should replace
local AnimationTrack = humanoid:LoadAnimation(Animation)
with
local AnimationTrack = humanoid.Animator:LoadAnimation(Animation)
?
If so, I’ve tried that and I didn’t get any errors…
Did you know humanoid load animation is deprecated? Use Humanoid.Animator:LoadAnimation() Deprecating LoadAnimation on Humanoid and AnimationController
Oh, I forgot to say that even though I didn’t get any errors, it still didn’t work and nothing happened.
As of now, what code do you have so far? And what type of script is it, localscript or regular script?
local script:
local Tool = script.Parent
local Animation = Tool.Animation
local Character
Tool.Activated:Connect(function()
print("Activated")
local humanoid = Character:WaitForChild("Humanoid")
local AnimationTrack = humanoid:LoadAnimation(Animation)
AnimationTrack:Play()
print("Should be playing?")
end)
Tool.Equipped:Connect(function()
Character = Tool.Parent
print(Character)
end)
Also, I have to go to sleep so I won’t respond for a few hours
Try this out?
local Tool = script.Parent
local Animation = Tool.Animation
local Character,Humanoid,Track
Tool.Activated:Connect(function()
print("Activated")
Track:Play()
print("Should be playing?")
end)
Tool.Equipped:Connect(function()
Character = Tool.Parent
Humanoid = Character:WaitForChild("Humanoid")
if not Track then
Track = Humanoid.Animator:LoadAnimation(Animation)
end
print(Character)
end)
Tool.Unequipped:Connect(function()
Character = nil
Humanoid = nil
Track:Stop() --Optional, remove if unneeded
end)
Made it so it sets the Character and Humanoid to nil
when you unequip the tool and set the Humanoid in Equipped and if the Track is not already loaded onto the Humanoid’s Animator, load it
@sudachipapa Thanks for pointing that out!
Tested it out and @EmbatTheHybrid solution worked for me at least. Might want to add Track:Stop()
to unequip.
What is the priority of the animation?
Action, although I’ll redo it just to make sure
edit: It still doesn’t work, even though I definitely set it to action
'oh wait! Will the animation still run if it’s R6 and my body is R15?
No, your bodyparts will not have the correct names & would result in some sort of error
Oh, that must have been why! I’ll try it but animate with R15
Your Animation object should be in correlation with the correct ROBLOX Body Type (R6, R15)
Using a R6 Character to play a R15 Animation will not work if you weren’t aware
I’m dumb, I didn’t realize that R6 animations don’t work on R15 avatars