Accidental T-Pose

I have an animation on a mesh character that plays when it dies, but when playing the animation, for a few milliseconds it goes into T pose, I tried changing the animation priority but I still can’t get rid of this error.

function onDied()
	local char = script.Parent
	char.HumanoidRootPart.Anchored = true
	local humanoid = char:FindFirstChild("Humanoid")
	if not humanoid then return end

	local deathAnim = humanoid:LoadAnimation(script.DieAnim)
	deathAnim.Looped = false

	deathAnim.Stopped:Connect(function()
		char.HumanoidRootPart.Anchored = false
	end)

	deathAnim:Play()
	pose = "Dead"
end

Hi i couldn’t get to replicate your t pose but i did hopefully fix your script. What i added is humanoid:SetStateEnabled(). Also humanoid:LoadAnimation() has been deprecated so i used the Animator instance instead. I hope both of these fixes will help your problem. I hope this helps! :slight_smile:

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local humanoid = char.Humanoid

local pose
local animationID -- set your animation id here

local function onDied()
	local hrp = char.HumanoidRootPart
	hrp.Anchored = true

	-- Use Animator
	local animator = Instance.new("Animator")
	animator.Parent = humanoid

	local deathAnim = Instance.new("Animation")
	deathAnim.AnimationId = "rbxassetid://"..animationID

	local playAnim = animator:LoadAnimation(deathAnim)
	playAnim.Priority = Enum.AnimationPriority.Action4

	playAnim.Stopped:Connect(function()
		humanoid.Health = 0
		humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, true)
		char.HumanoidRootPart.Anchored = false
	end)

	playAnim:Play()
	
	pose = "Dead"
end

humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false)

humanoid.HealthChanged:Connect(function()
	if humanoid.Health <= 0 then
		onDied()
	end
end)

thanks for the help, but im still having the same problem

I think its because theres another animation playing, like the running one? And that’s why it glitches and then the mesh character dies. So i think maybe try to detect if its moving/attacking and then play your “death” animation, or animate the run so it fades smoothly to the death animation? Sorry I am so bad at explaining.

Ive seen this problem before. I think its due to the order of how you play/stopthe animations. Try the following in order:

  1. play death animation
  2. immediately stop all current animation (excluding the death)

Also trying to play death animation with a 0.1 blend is typically a good idea

I still have the same problem, I tried to stop the animations before, stop them after, change the animation priority, and everything is still the same.

have you already tried preloading the animation (prior to npc dying) and playing it when the npc does die
ex:

local AnimationTrack = Humanoid.Animator:LoadAnimation(tragetAnimation)

function onDied()
AnimationTrack:Play()
end
1 Like

I think it’s because while the detath animation loads, there isn’t any animation running currently and that causes it to go to its default rig state (t-pose) before the death animation is played. Try preloading the death animation and see if that helps.

1 Like