Humanoid.Died not working for a non-character model

I am trying to create a spaceship using roblox’s humanoid system because it has settings prebuilt into it which make coding it easier.

However, I cannot make a function fire when the humanoid dies, even though I included a script into the spaceship which does :TakeDamage(60) twice. the Ship’s maxhealth is currently 100, so the ship dies in two instance of :TakeDamage(60).

The function I made which is connected to .Died is supposed to print “Died.” for testing purposes. However, it just does not work, despite the humanoid’s health going to 0.

My Workspace

image

My Code in short
local myHuman = myModel.Humanoid

myHuman.Died:Connect(function()
	print("Died")
end)
Why this should work

do you have Humanoid.RequiresNeck turned off

Is Humanoid.RequireNeck enabled?

@Sniperkaos
@ClearlyVi
Yes, it’s turned off

PS: This code works

myHuman.HealthChanged:Connect(function(newhealth)
	if newhealth <= 0 then
		print("Died")
	else print("Damaged")
		print(newhealth)
	end
end)

Now, just use ChangeState method.
You can use ChangeState do Died “Ship.PrimaryPart.Destroying” event too.

Even when I change the StateType to dead, it doesn’t fire the humanoid.Died event.

Is EvaluateStateMachine turned off? If so, enable it.

The documentation also says that you need a Torso connected to the Head.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.