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

How do I check if an animation is playing?

Asked by
Lucke0051 165
6 years ago

I want to check to see if an animation is playing on a character.

3 answers

Log in to vote
2
Answered by
metryy 306 Moderation Voter
6 years ago

There's a property called "IsPlaying" in animations that returns either true if the animation is playing or false if it isn't

Example:

local function AnimPlaying(animation)
    if animation:IsA("AnimationTrack") then
        if animation.IsPlaying then
            print(animation.Name.."is playing.")
            return true
        else
            print(animation.Name.."is not playing.")
            return false 
        end
    else 
    error(animation.Name.."must be an AnimationTrack.")
end

AnimPlaying(animation)
Ad
Log in to vote
0
Answered by 6 years ago

Check this wiki link: here

Log in to vote
0
Answered by 6 years ago

Use a debugging variable to define when the animation has started and stopped

--this is an example and not an entire animation script
local animplaying = false
function loadtrack()
animplaying = true
wait(track.length)
animplaying = false
end

Answer this question