How can I stop any playing animations on this player?
Thanks!!
if emoteid == 1 then
-- Threaten
local animcheer = script.Parent.Threaten
local Hum = game.Workspace[plrf].Humanoid
local anim = Hum:LoadAnimation(animcheer)
-- stop all other animations and set walking speed to 0
anim:Play()
elseif emoteid == 2 then
-- Cry
local animcheer = script.Parent.Cry
local Hum = game.Workspace[plrf].Humanoid
local anim = Hum:LoadAnimation(animcheer)
anim:Play()
end
Animators can return all playing AnimationTracks with Animator:GetPlayingAnimationTracks()
Simply loop over all the animation tracks and stop them.
Note: not sure if this will mess up core animations such as the default walk and stuff but you can try
local Animator = Hum:FindFirstChildWhichIsA("Animator")
local PlayingAnimationTracks = Animator:GetPlayingAnimationTracks()
for _, Track in PlayingAnimationTracks do
Track:Stop()
end
You are trying to call Animation:Stop() on the whole table of animation tracks. You would have to loop through the table and individually stop each one.
local tracks = animator:GetPlayingAnimationTracks()
for _, track in tracks do
track:Stop()
end