So other topics about instantly healing full HP or max HP on low health is for players and I don’t know how to work with that but here is my script
I don’t want it to clone, or at least I’d prefer the last resort to be cloning because it’s a scripted model that moves left and right and if it clones it might mess it up
I also tried using the default health regen script but that didn’t go the way I needed it to
local Character = script.Parent
local Health = Character.Health
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false)
if Humanoid.Health <= 1 then
wait(1)
Humanoid.Health = 100
end
-- get a reference to the character
local character = script.Parent
-- wait for the humanoid
local humanoid = character:WaitForChild("Humanoid")
-- prevent the humanoid from entering the dead state
humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false)
-- when the humanoid health changes call this function
humanoid.HealthChanged:Connect(function(health)
-- if the health is greater then 0 exit the function early and do nothing
if health > 0 then return end
-- set the humanoid health back to max
humanoid.Health = humanoid.MaxHealth
end)