The title say all: i want know with a boolean or something else if the idle animation of the player has stopped. Its possible?
2 Likes
You can index the IsPlaying
property of AnimationTracks to tell you if the AnimationTrack is playing or not, no need for functions.
local IdleAnimation -- your idle animation
if IdleAnimation.IsPlaying then
print("AnimationTrack is not playing")
end
Although if you want to make a function that’ll return whether or not the animationtrack is playing, you can just return the property itself:
local function IsAnimationPlaying(animation)
return animation.IsPlaying
end
print(IsAnimationPlaying(IdleAnimation)) -- prints whether or not the idleanimation is playing
3 Likes
As stated by metryy, .IsPlaying will work for checking if it’s running. But, if you also would like to do something as soon as it stops, AnimationTrack.Stopped is what you’ll want:
local idleAnimation -- your AnimationTrack for the idle animation
local stopped
local function IdleStopped()
-- the idle animation stopped
stopped:Disconnect() -- disconnect the event if you only wanted this to run once, or something
stopped = nil -- this too
end
stopped = idleAnimation.Stopped:Connect(IdleStopped)
1 Like
Or you can for loop through all of the animations you get from:
Humanoid:GetPlayingAnimationTracks()
2 Likes