I would make the health go to 5 or less. Then set a bool value called dead to true. Then set health to 100. From what I understand once player is dead it’s dead.
I did it once with a NumberValue inside the player’s character called FakeHealth.
However, I’m really hoping it’s possible to change this behavior, otherwise I’ll have to change a lot in my current code.
Well tour current function only fires when it dies. So that’s the only real way to do it. You could just check player health without a value and if plr health <= 5 then revive
Sounds like a hacky solution. I don’t really understand why ROBLOX won’t allow changing the Humanoid’s state after dying.
Even using :ChangeState() won’t change it. Apparently it gets locked or something.
I think it is because all the joints break on death…
If the neck and the waist gets destroyed then there is no way to revive the character, And also changing the state to Enum.HumanoidStateType.None after being dead is of no good…
So whenever you need to revive the player :-
First disable the Enum.HumanoidStateType.Dead humanoid state
Then change BreakJointsOnDeath property of the humanoid to false
No, I mean you log the position when the player dies, then load the character
humanoid.Died:Connect(function()
local pos = humanoid.Parent:FindFirstChild("HumanoidRootPart").Position
local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)
player:LoadCharacter()
player.Character:WaitForChild('HumanoidRootPart').CFrame = Cframe.new(pos)
end)
Written on mobile so there could be some errors, just understand the general point
Still haven’t found a solution? I am now trying to solve this problem too
Now I do it like this … but it seems to me that this code is vulnerable (The client may simply not send RemoteEventUpdateHP:FireServer())
LocalScript:
Summary
local ReplicatedStorage = game:GetService("ReplicatedStorage") --
local RemoteEventUpdateHP = ReplicatedStorage:WaitForChild("RemoteEventUpdateHP")
local humh1 = game.Players.LocalPlayer.Character:WaitForChild("Humanoid",5)
local function UpdateHP()
if humh1.Health < 5 then
RemoteEventUpdateHP:FireServer()
end
end
humh1.Changed:Connect(UpdateHP)
ServerScript:
Summary
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEventUpdateHP")
local function onUpdateHP(player)
local TytHuma = player.Character:FindFirstChild("Humanoid")
TytHuma.Health = 20
--Here I want to insert an animation of a lying character
end
remoteEvent.OnServerEvent:Connect(onUpdateHP)
This method makes me very angry, besides, I see at least 2 games done somehow differently … I feel like they just somehow revive a dead player
An alternate solution will be to record the humanoid’s root part CFrame right before it resets, and then teleport the player to that CFrame once it dies and respawns.