So these days I’ve been working on exploding objects. For example, an exploding gas tank. Everything works normally, after the object is shot several times, the Humanoid dies (.Died) and then the effect of the explosion is triggered.
I was able to create my own way of regenerating the object, by cloning a copy of the object (ReplicatedStorage) and setting it’s Parent to Workspace, placing it in the same position and orientation.
Is there any other easier way to revive Humanoid after it dies?
It would be much better and easier if I could somehow revive the same Humanoid that died.
this would prevent the humanoid from dying, just make a if statement to check if ther health goes below 1!
game.Players.LocalPlayer.Character:WaitForChild("Humanoid").HealthChanged:Connect(function()
if game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Health <=1 then
game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Health = 40
end
end)
you can make the person crawl, like he’s downed and need to be healed, waiting 2 seconds will result in it breaking bc it will kill the person and will respawn before the cooldown stops
or if you want simplier, you give the person 1 health while he’s in a ragdol state then heal him
I’m trying to make a gas tank that explodes on a .Died signal regenerate, not a player. If I add wait(2) delay to the script, random player can hit the object again in the meantime, and <=1 will no longer count. This means that the object will not even regenerate after those 2 seconds.
This won’t actually do anything because its in a local script, you use LocalPlayer so I assume you mean a local script, but changing the health locally won’t help if the health is being taken away on the server, as the humanoid would still die on the server.
This was a fun problem to solve for me. I use skinned meshes. When skinned meshes die, they go to T pose. It’s looks dumb. I had to postpone death, so that I could play a death animation and manually kill critters mid-animation.
Here’s some of those steps:
Introduce a “DEAD” tag under CollectionService. Anything with this tag is ignored for all damage and attacks. This replaces 0 health and the .Died event.
I use a debounce DURING death.
I prevent death with this code:
if defender.Humanoid.Health <= attackDamage and defender.Humanoid.Health > 0 and not CollectionService:HasTag(defender, deadTag) then
CollectionService:AddTag(defender, deadTag)
if not deathDebounce[defender] then
deathDebounce[defender] = true
-- start death animation, wait 3, destroy
end
else
defender.Humanoid:TakeDamage(attackDamage)
end