How do i check if animation is playing or not

Me, being the silly goober, tried this:

while Anim.Playing == true then

end

Well obviously that didn’t work, but uhhh, is there some sort of way to check whether it’s playing or not?

3 Likes

In your case, you can use if then statement to check if requirement has been meet or not, which is additionally allows you to use else or elseif argument:

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:FindFirstChildOfClass("Humanoid")

local Anim = script.Animation
local AnimTrack = Humanoid:LoadAnimation(Anim)

AnimTrack:Play()

if AnimTrack.IsPlaying == true then
	print("Animation "..Anim.Name.." has been played!")
elseif AnimTrack.IsPlaying == false then
	print("Animation "..Anim.Name.." has not been played. You may need to play it!")
end
7 Likes

You can do:

if animationTrack.IsPlaying then
print("animation playing")
end
5 Likes

so if instead of while, sure.

mfw i find out it’s IsPlaying.

thanks!!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.