Hello there, I have a tool and by default, it only goes in the players right hand but I want it to be held in both of their hands. Here is the part of my script with the animation in it. tool is a variable and the animation is looped but is not playing. The error message: Play is not a valid member of Animation "Workspace.Wildcutepenguin.Blade of Grass.Animation"
tool.Equipped:Connect(function()
tool.Animation:Play()
end)
tool.Unequipped:Connect(function()
tool.Animation:Stop()
end)
1 Like
You need to load the animation into the Character’s humanoid, that’ll give you the AnimationTrack that you use :Play()
and :Stop()
on, Animation instances don’t have that function, an example would be this
local tool = script.Parent
local char,hum,track
tool.Equipped:Connect(function()
char = tool.Parent
hum = char:WaitForChild("Humanoid")
if not track then
track = hum.Animator:LoadAnimation(tool.Animation)
end
track:Play()
end)
tool.Unequipped:Connect(function()
track:Stop()
char, hum = nil,nil
end)
4 Likes
The character probably didn’t have time to load in by the time the script ran, try out the example I gave
I think it works but does the animation have to be set to action or something? Because right now it’s set to core.
Yes, you need to give it a priority higher than core
, since this is your idle animation most likely, set it to Idle
, if that doesn’t work, you could try Movement
, reserve Action for things like attack animations for example
The left-arm works but the right arm is in the default position.
What’s the priority of it as of now? Did you remember to give the right arm an animation?
The priority is idle and yes, I did remember to give the right arm an animation.
What happens if you try a priority like Movement
?
Yes, now it works, thank you for the help!
1 Like
Anytime! If you have anymore issues don’t be afraid to make another post!
2 Likes