How to tell if animation has stopped playing from another script?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to be able to tell if a player’s slash animation has stopped playing.
  2. What is the issue? Include screenshots / videos if possible!
    I don’t know how to do that
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried many things including looking on the dev hub but
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
    script that i want if anim ended
local Dummy=script.Parent
local debounce=false

Dummy.Touched:Connect(function(hit)
	debounce=true
		if not hit.Parent.Parent:FindFirstChild('Humanoid') then
			return
		end
 
		local player = game.Players[hit.Parent.Parent.Name]
		local OV=player:WaitForChild('OV')
		if OV.Strength.Value>1000 and debounce==true then
		OV.Strength.Value += OV.StrAreaMulti.Value*OV.StrMulti.Value*1.25 
		local tracks=player.Character.Humanoid.Animator:GetChildren()
		repeat task.wait() until tracks["slash"]==nil --fires next instant as roblox immediately removes the anim from the list
		
	print("slash finished")
		debounce=false
		else return
		end 
	end)

part of script that plays it

Sword.Activated:Connect(function()
	if debounce==false then
		debounce=true
		local slashTrack=player.Character.Humanoid.Animator:LoadAnimation(slash)
		slashTrack:Play()
		print(slashTrack.Parent)
		local Damage=10+(Strength.Value/4)
		Handle.Touched:Connect(function(hit)
			if not hit.Parent:FindFirstChild("Humanoid") then return end

			if hit.Parent~=Sword.Parent and hit.Parent.Humanoid and damageDebounce==false then
				damageDebounce=true
				hit.Parent.Humanoid:TakeDamage(Damage)

			end
		end)
		slashTrack.Stopped:Wait()
		print("slash finished")
		damageDebounce=false
		Strength.Value+=StrMulti.Value*StrAreaMulti.Value
		debounce=false
	end
end)

the scripts are normal scripts, the latter is in a tool equipped by the player, and the former is in a dummy in workspace if it helps.
i need to sleep!
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

.Stopped:Wait()

You wait for this signal to fire (as you have done) and then fire a signal in the other script indicating as such.

1 Like

or you can try

Variable.Ended:Wait()

AnimationTracks don’t have an .Ended signal.

I would like to apologize, I forgot that was a AnimTrack :upside_down_face: