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

Detect If animation is playing?

I need to be able to detect if the animation is playing, so i can activate script. Here's a snippet:

local animation = hum:LoadAnimation(anims[attack]);
				
				animation:Play();

			while animation:IsPlaying() do
				
				plr.Character.RightHand.Touched:connect(function(hit)
			

1 answer

while(animation:IsPlaying()) do
	local touched = plr.Character.RightHand.Touched:connect(function(hit)
	-- do whatever
	end)
end

-- animation isn't playing anymore, disconnect the touched event
touched:disconnect();

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