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

Animation not stopping?

Asked by
u_g 90
10 years ago

I've tried stopping an animation, but it just doesn't work. It keeps on saying "Stop is not a valid member of Animation.", and I use ":Stop" for a variable, yet it still doesn't work. Here's the code:

script.Parent.Parent.Unequipped:connect(function()
    local anim = script.Parent.Animation
anim:Stop()
end)

Please help.

0
Are you sure the Animation is named 'Animation'? Does that variable's path lead to the animation? Shawnyg 4330 — 10y
0
Yes, the animation's name is "Animation". u_g 90 — 10y

2 answers

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

Well, the way you're doing it is incorrect. To play an Animation, you load it to the humanoid. So, since this is another script, I recommend making the anim variable in the animation playing script global _G.anim. That way, you can access it in this script and put _G.anim:Stop().

0
It still doesn't work... it says "Stop isn't a valid member of Animation". u_g 90 — 10y
0
Are you sure you're putting `:Stop()` not `.Stop()`? Shawnyg 4330 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

or anim:Remove() function

Answer this question