How to detect character death with EvaluateStateMachine disabled?

The reason is I’m making the player a controllable ball using the following setup:
image
The scripting part of moving and such works completely fine. I am getting a warning however, but that’s not got anything to do with it:


(If you know a solution to get rid of that aswell without adding an unnecessary torso, that would be nice)

The actual problem is that i need EvaluateStateMachine to be disabled, so the humanoid isn’t controllable like usual character rigs. The problem with the property being disabled is that events like humanoid.Died will not fire on death (Both resetting and falling to FallenPartsDestroyHeight). If i enable the setting, then yes, the event fires.

Is there some kind of way to detect a character’s death with EvaluateStateMachine disabled?

I’m not familier with EvaluateStateMachine, but
you could try checking hp maybe? (idk if that’d still change, but if it does, just connect it to a .changed event)
Maybe joints? idk if those still get destroyed but if they do just check if they still exist (i think there was a on destroyed event)
I believe you could also check if Player.Character has changed, but im not sure either

Nice, i didn’t even think about firing an event when the health changes. However, there is a catch to it, because when you die from the void, you don’t actually loose health, so i had to also fire an event for when the ball’s parent changes:

local function respawn()
	print("Respawning...")
end

humanoid:GetPropertyChangedSignal("Health"):Connect(function()
	if humanoid.Health == 0 then respawn() end
end)

rootPart.AncestryChanged:Connect(function()
	respawn()
end)

Note: I don’t know if this solution is reliable though, so any new suggestions are greatly appreciated aswell :+1:

1 Like

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