Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you stop an animation using a script?

I've tried many things but I can't get this to work, could somebody please help me out? :)

Thanks :)

1 comment

0

I commented on my answer, I am commenting here just to notify you.

1 answer

✓ Accepted answer

Defining the animation

local anim =  player.Humanoid:LoadAnimation(script.Animation)

Playing the animation

anim:Play()

Then stopping it

anim:Stop()
local anim =  player.Humanoid:LoadAnimation(script.Animation)
anim:Play()
wait(1)
anim:Stop()

6 comments

0

alright :) I got that down, but another thing I forgot to mention is I want to script it so that if the animation is already playing to stop it.

0

i asked this question wrong LOL but u did answer it so thank u xD

0

anim:Stop() attempts to stop the animation without breaking even if the animation wasn't even playing. If you really want to check before you stop the animation then instead of anim:Stop() write if anim.IsPlaying then anim:Stop() end

0

I am writing functions to stop the animations and they aren't stopping them? function endOne() local oneTrack = hum:LoadAnimation(animation1) if oneTrack.IsPlaying then oneTrack:Stop() end end

0

What. Uh... Remove function endOne() and remove an end

0

OOOOOH I fixed it!!! I didn't even need the functions. I was defining the animations within like an "if" and stuff so it was being weird lol. ANYWAY!!! THANK YOU VERY MUCH FOR YOUR HELP! :) you're awesome bro God loves you SO MUCH :) Bless u man Jesus loves u

This discussion is preserved as it was. New answers, comments, and votes are closed.