Animations stopping but it is priority is in action4

Can you send the script where you play the animation? I can tell it that the priority sure isn’t the problem, because I’ve had this issue in the past but forgot how I fixed it.

local myeventsfolder = replicatedstorage.MYEVENTS
local animationfolder = replicatedstorage.ANIMATIONS
local players = game.Players

myeventsfolder.FINISHER.OnServerEvent:Connect(function(player, enemycharacter:Model)
	if players:GetPlayerFromCharacter(enemycharacter) ~= nil then return end
	if enemycharacter:GetAttribute("Downed") then return end
	local maincharacter = player.Character
	local mainhumanoid:Humanoid = maincharacter:FindFirstChild("Humanoid")
	local enemyhumanoid:Humanoid = enemycharacter:FindFirstChild("Humanoid")	
	enemyhumanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false)
	local enemytakedown = animationfolder.VICTIMFINISHER
	local mctakedown = animationfolder.MCFINISHER
	local enemyanimator:Animator = enemyhumanoid:FindFirstChild("Animator")
	local mainanimator:Animator = mainhumanoid:FindFirstChild("Animator")
	if enemyanimator and mainanimator then
		for i, v:AnimationTrack in pairs(enemyanimator:GetPlayingAnimationTracks()) do
			v:Stop()
		end
		for i, v:AnimationTrack in pairs(mainanimator:GetPlayingAnimationTracks()) do
			v:Stop()
		end
		mainhumanoid.WalkSpeed = 0 ; enemyhumanoid.WalkSpeed = 0 ; mainhumanoid.JumpHeight = 0 ; enemyhumanoid.JumpHeight = 0
		local animtrack1 = mainanimator:LoadAnimation(mctakedown)
		animtrack1.Priority = Enum.AnimationPriority.Action4
		local animtrack2 = enemyanimator:LoadAnimation(enemytakedown)
		animtrack2.Priority = Enum.AnimationPriority.Action4
		enemycharacter.PrimaryPart.CFrame = maincharacter.PrimaryPart.CFrame * CFrame.new(0, 0, -3)
		animtrack1:Play();animtrack2:Play()
		maincharacter.PrimaryPart.Anchored = true
		enemycharacter.PrimaryPart.Anchored = true
		wait(1.7)
		animtrack2:AdjustSpeed(0) ; animtrack1:AdjustSpeed(0)
		local sound = Instance.new("Sound", enemycharacter.Head)
		sound.SoundId = "rbxassetid://9113800060"
		sound.Volume = 100
		sound.RollOffMaxDistance = 9
		sound:Play()
		wait(3)
		animtrack2:Stop() ; animtrack1:Stop()
		enemyhumanoid.Health -= 10
		mainhumanoid.WalkSpeed = 16
		mainhumanoid.JumpHeight = 7.2
		maincharacter.PrimaryPart.Anchored = false
		local deadanimtrack = enemyanimator:LoadAnimation(animationfolder.STUNNED)
		deadanimtrack.Priority = Enum.AnimationPriority.Action4
		print(deadanimtrack.Priority)
		print(animtrack2.Priority)
		print(animtrack1.Priority)
		deadanimtrack:Play()
		wait(1.30)
		deadanimtrack:AdjustSpeed(0)
		enemycharacter:SetAttribute("Downed")
	end
end)

try temporarily removing these

		for i, v:AnimationTrack in pairs(enemyanimator:GetPlayingAnimationTracks()) do
			v:Stop()
		end
		for i, v:AnimationTrack in pairs(mainanimator:GetPlayingAnimationTracks()) do
			v:Stop()
		end

also tips for typing in lua in the devforum or most website type lua after your three ``` to make it more readable

2 Likes

I tried it but it did not work.

1 Like

The thing that leaved me confused is that within the first time of firing the animation is simple perfect but the second time is that is when the animation gets really f’ed up.

1 Like

You can try re-writing it, because it’s a little bit messy and I don’t recommend using waits like this (i used to do that before and paid the price)

You can use things like delays and stuff

idk if you should do this doe lmfao

1 Like