Help With NPC Combo

So I am attempting to make an npc have a combo system, however it isn’t working, it only plays the first animation and repeatedly plays only the first one. Can somebody tell me whats wrong with my script? No output errors btw.

local Anim = Enemy:LoadAnimation(Animation)
local Anim1 = Enemy:LoadAnimation(Animation1)
local number = 1
function Hit(hit)
	if hit.Parent ~= nil then
		local TargetHum = hit.Parent:FindFirstChild("Humanoid")
		if hit.Parent:FindFirstChild("Humanoid") ~= nil and hit.Parent:FindFirstChild("Humanoid"):IsA("Humanoid") and AttackEnabled == true and TargetHum ~= Enemy then
			if not hit.Parent:FindFirstChild("NPC") then
			
			AttackEnabled = false
			delay(.5,function() AttackEnabled = true end)
		
			if Anim and number == 1 then Anim:Play() number = 2 end
			if Anim and number == 2 then Anim1:Play() number = 1 end
			DamageTag(TargetHum.Parent,5)
	  		end
		end	
	end
end

Right now you are checking if 1 is played, and if so, play 2 right after 1 starts. Is this intentional, or do you want 2 to play after 1 finishes?

I want it to play 2 after 1 finishes

Yeah alright. So you would want to play 2 when 1 is completed. Luckily, there is a event for this

Anim:Play()
Anim.Completed:Connect(function()
 Anim1:Play()
end)

If you have any questions, just ask.

Sorry for replying so late, but wouldnt that just make it where it only plays the animation and would not do damage? And also it says That Completed is not part of Anim or something along those lines

Sorry my bad.

Anim:Play()
Anim.Stopped:Connect(function()
 Anim1:Play()
 DamageTag(TargetHum.Parent,5)
end)