Animation not playing correctly on respawn

I have made various training dummies in my game where you gain stats by attacking them.
I made an animation that plays each time the dummy is attacked of getting knocked down and bouncing back up and it works great except for when the dummy respawns. Once I makejoints, the head and torso of the dummy are set to cancollide = true and I can’t get them to stay off. I did a little research and there are some hackish? ways around this and I was wondering what the best method for my usecase would be.

edit: please see my comment below as it is not a problem with cancollide at all I think

Running a script on renderstep to set them to false. (worried about resources as there are about 100 of these dummies total)

Creating a collision group (not sure if this is the best way as the dummies are not required to move except for the knockback animation)

Working around this by not using humanoids at all or some other respawn method.

Here is the script I am using now:

local Figure = script.Parent

local Humanoid = Figure:WaitForChild("Humanoid")

local Respawn = Figure:Clone()

local anim = script.Animation

local animtrack = Humanoid:LoadAnimation(anim)

Humanoid.HealthChanged:Connect(function()
	wait(0.1)
	Figure.Head.face.Texture = "http://www.roblox.com/asset/?id=132894111"
	animtrack:Play()
	wait(0.3)
	Figure.Head.face.Texture = "http://www.roblox.com/asset/?id=294435787"
end)


function onDied()
	wait(1)
	Figure:Destroy()
	wait(5)
	Respawn.Parent = game.Workspace
	Respawn:MakeJoints()
end



Humanoid.Died:connect(onDied)

I was trying some additional ideas I had and it seems like it is not the cancollide thing at all.
When the game starts, the parts become cancollide from the start.

Does anyone know why the animation plays right on the first humanoid and not on any respawns?
To be more specific, the animation looks like it plays in the arms, but not the torso.
1st dummy

2nd dummy

Sorry for the confusion.

In your script you are only loading the animation onto the first humanoid.

Add these line to your onDied() function

Humanoid = Respawn:FindFirstChildWhichIsA("Humanoid")
animTrack = Humanoid:LoadAnimation(anim)
1 Like

I tried that and it looks like the animation is playing like before, but only the arms move and not the head or torso.

I think since the script is inside the figure, it gets ran each time the dummy respawns.

I am going to try reanimating it next. Maybe that is the problem, idk.

Ugh…I finally figured it out.
I had the HumanoidRootPart welded to the Torso instead of using a motor6d!
:man_facepalming: