Isn’t the issue using a LocalScript for this? IIRC what actually kills the player when setting the health locally is the joints breaking for a fraction of a second, not the health itself. I see the bar being glitched, but is the health actually going negative? I feel like it’s a server vs client discrepancy.
Interestingly enough, using a server script actually does fix the issue. However, the client has control over the player’s health, so the fact that this happens with a LocalScript should still be fixed.
I ran your script and I saw the red health bar extend far backwards for a brief moment every second. This makes no sense that it happens. I also ran the following in between respawns.
local humanoid = game.Players.LocalPlayer.Character.Humanoid
humanoid:GetPropertyChangedSignal("Health"):Connect(function()
print(humanoid.Health)
end)
And yes, the health is negative for a few frames at a time.
I do have a question about this:
Can you help me understand how the client has control over the local player’s character health? In my testing, the only change I’m able to replicate to the server is setting the health to zero, which produces the same result as clicking “Reset Character” in the menu. Any value above zero that I’ve tried doesn’t replicate.
I don’t know the exact details, but the client being able to kill the player is intended behavior, so this issue that can occur while attempting to kill the player should be resolved.