No animation plays after custom animation

Hello, I’m having a problem with an animation I made. Let me explain, because I can’t video record. It’s a simple stomp animation, and it’s priority is action. So if I stomp while holding w or moving in any direction, i’ll do the stomp animation, but when the animation ends, I end up moving but with no animation. Just float walking. How do I stop this? I dont want to have to go in the animate script and have to edit it to solve this bug. I want it to continue to play the walking animation after my animation is done.

Perhaps your animation has never actually stopped, and is frozen at the last keyframe? I don’t see why the core walking would freeze because of your animation. Also, why can’t you record a video?

This would be better solved if we could see a screenshot of the script. Is your animation in a function so that when the function is successfully called it reverts to the original animation status?

local tool = script.Parent
local animation = tool.Animation
local damageratio = 100
local debounce = false
local cooldown = 0
local connection

tool.Activated:Connect(function()
	local char = script.Parent.Parent
	local plr = game.Players:GetPlayerFromCharacter(char)
	local jumpheightfactor = game.ServerStorage.JumpHeight.Value
	
	if debounce or char.Humanoid.Health == 0 then return end
	debounce = true
	
	local hitbox = Instance.new("Part", game.Workspace)
	local weld = Instance.new("WeldConstraint", hitbox)
	
	-- set weld
	weld.Part0 = hitbox
	weld.Part1 = char.RightFoot
	hitbox.Position = char.RightFoot.Position
	hitbox.Orientation = Vector3.new(0, char.RightFoot.Orientation.Y, 0)
	hitbox.Size = Vector3.new(3.2, 1, 3) * plr.leaderstats.Size.Value
	hitbox.CanCollide = false
	hitbox.Transparency = .3
	
	-- play animation
	local animator = Instance.new("Animator", char.Humanoid)
	local track = animator:LoadAnimation(animation)
	track:Play()
	
	-- prevent jumping
	char.Humanoid.JumpHeight = 0
	
	-- reorient
	coroutine.resume(coroutine.create(function()
		while hitbox do
			wait(0.05)
			hitbox.Orientation = Vector3.new(0, char.RightFoot.Orientation.Y, 0)
		end
	end))
	
	-- listen for hits
	local connection = hitbox.Touched:Connect(function(hit)
		local damage = char.Humanoid.MaxHealth / damageratio
		
		if hit.Parent:FindFirstChild("Humanoid") then
			local o_char = hit.Parent
			o_char.Humanoid:TakeDamage(damage)
		end
	end)
	
	-- reset
	track.Stopped:Connect(function()
		connection:Disconnect()
		char.Humanoid.JumpHeight = jumpheightfactor * plr.leaderstats.Size.Value
		hitbox:Destroy()
		coroutine.resume(coroutine.create(function()
			wait(cooldown)
			debounce = false
		end))
	end)
end)

image

Okay, basically when I run into this problem all I do is go into the Character find the Animate script and disable it, then re-enable.

( Check the animation priority and it could also be on a loop )

Also, maybe make track a global variable, so that you aren’t loading the same animation a ton of times.

Do you want to be able to have the player stomp while moving? If not you can just make the player’s walkspeed 0 before the animation is run.