Is there a way to make a Model kill you during Animation?

So I’m trying to make a model that kills the player at touch. but so far I couldn’t achieve it using my methods.
The method I used didn’t work, here is the script I made.

for _, child in pairs(dino:GetChildren()) do
	-- Filter out non-part objects, such as Shirt, Pants and Humanoid
	-- R15 use MeshPart and R6 use Part, so we use BasePart here to detect both:
	if child:IsA("MeshPart") then
		child.Touched:Connect(function(h)
			if h.Parent:FindFirstChild('Humanoid') then
				h.Parent:FindFirstChild('Humanoid'):TakeDamage(100)
			end
		end)
	end
end

I can’t figure out any other methods.
Can someone please help me with this?

I think what you are doing is looping through each instance inside of the player’s character model instead of the actual model? You haven’t included what “dino” is, so I could be wrong. Also, when trying to detect unknown types of parts (such as in a model), you should search for BaseParts, as that includes all part types. This is useful for when your game supports R15 and R6, because like the comments in your code suggest, BasePart can detect the two different part types in both character models. Anyway…

If you have multiple instances with parts parented to them inside of a single model (e.g. models inside of models inside of models…) then you should use GetDescendants instead of GetChildren, but this could cause performance issues quickly. Another alternative would be making a hitbox around the model and connecting the touched function to that instead of every part inside of the model, though this may not be viable for models without a basic cube/cuboid shape. You may need to add multiple hitbox parts for more complexly shaped models.

I realised that touch events don’t work during an animation of a skinned mesh.
the function will apply only if I touch where the model was originally before the animation started
robloxapp-20210820-1018482.wmv (3.6 MB)

Is there any way to make a touch event during an animation???

Maybe try looking at the :IsA("Model") or more info here.
:IsA()


I realised that touch events don’t work during an animation of a skinned mesh.
the function will apply only if I touch where the model was originally before the animation started

Is there any way to make a touch event during an animation???