Hello, I am making a combat game and I want to make it so your character doesn’t “die”. It never reaches 0 hp, because I’m trying to make an animation play when the character “dies”. But I want it to be easily configurable.
I have this script done so far but it doesn’t work.
local hum = char.Humanoid
local Animator = hum.Animator
hum.BreakJointsOnDeath = false
hum:SetStateEnabled(Enum.HumanoidStateType.Dead, false)
local ST = Instance.new('IntValue')
ST.Parent = hum
ST.Name = 'Stun'
local hDebounce = false
hum.HealthChanged:Connect(function()
if (hum.Health == 0 and hDebounce == false) then
hum.Health = 50
Animator:LoadAnimation(script.Animations.Awaken):Play()
end
end)
Is there an alternative way? I just want the character death to be animatable, and configurable.
When a humanoid’s “Health” property reaches 0 the humanoid’s state is repetitively set to “Dead”, this can’t be avoided by simply setting the “Health” property to some value greater than 0.
What you need to do is disable the humanoid’s “Dead” state (this must be performed while the humanoid is alive) while they should be invincible and then re-enable it again when the effect has worn off.