I am hoping to prevent the humanoids health from going to 0 and the state changing to died. In other words, I am hoping to prevent the humanoids health from even reaching 0 and staying above it. This will be a key feature for my ragdoll system I have in place for my game. Currently when a players health reaches zero, their joints will not break but they will respawn after reaching the respawn time.
Not sure how I am supposed to do this nor what would be necessary to change for it. If anyone has any form of solution to achieve this, I am all ears. Yes I have already disabled breakjoints on death and requires neck.
Whenever you are making damaging script then you can check for health.
local damage = 10 -- The damage
local humanoid = character.Humanoid -- The character humanoid.
local formula = (humanoid.Health - damage) -- Before dealing damage we will substract health with the damage
if formula <= 5 then return end -- If player gets damage then after damage is delt then it will check if their health is 5 or below then it will not continue.
humanoid:TakeDamage(damage) -- If health is more than 5 then it player will take damage.
I believe the latter needs to be set on the server and on the client as setting a state’s enabled-ness does not replicate across the client-server boundary, I assume this is necessary as there are both server scripts and local scripts listening to the humanoid’s state.