Reproduction Steps
This bug is very hard to reproduce intentionally, however so far it seems to happen when a humanoid takes more damage than it’s current health.
Expected Behavior
I expect server-sided Humanoid.Died event connections to fire whenever a humanoid’s health hits 0.
Actual Behavior
Sometimes it works as intended, but sometimes the humanoid’s health will hit 0 and the client will enter a falling-down state however the .Died event connection on the server never fires.
Workaround
I have changed my code that uses Humanoid.Died to:
local event
event = Humanoid:GetPropertyChangedSignal('Health'):connect(function()
if Humanoid.Health <= 0 then
event:Disconnect()
game:GetService('RunService').Heartbeat:wait() -- have to yield for a frame to simulate the behavior of .Died
-- my previous .Died code
end
end)
Issue Area: Engine Issue Type: Other Impact: Moderate Frequency: Often Date First Experienced: 2021-08-23 15:08:00 (-04:00) Date Last Experienced: 2021-08-24 03:08:00 (-04:00)
local a = workspace:WaitForChild("Dummy1")
local b = workspace:WaitForChild("Dummy2")
local c = workspace:WaitForChild("Dummy3")
for i, v in pairs(game.Workspace:GetChildren()) do
if v:FindFirstChild("Humanoid") then
print("Found "..v.Name.."!")
v.Humanoid.Died:Connect(function()
print(v.Name.." died.")
end)
end
end
Output:
In fact, I was playing a game yesterday and it was broken despite it not being updated in a week and it worked after the update.
I think this should be severe. repro.rbxl (34.1 KB)
How are you damaging the humanoids? My game was only suffering the bug periodically because I’m killing player humanoids using :TakeDamage() I was also unable to get a reliable reproduction. With that being said, while technically severe there are some work arounds.
EDIT: never mind I just saw you damaged them using both property changing and :TakeDamage().
Humanoids can be quite finicky sometimes with network ownership. Make sure that you are trying to kill them from a server script, and that the network ownership is also set to the server manually using SetNetworkOwner. You can also set network ownership to a particular player, and then kill the humanoid from a LocalScript that that specific player runs.
Oddly enough, whenever this bug occurs, it appears to occur for every occurrence of a humanoid with the same name. For example, if you have several humanoids named “Bot”, all of them will encounter this .Died bug for their next non-detected death. Might be coincidence, I am unsure.
However, I suspect it might be related to network ownership / replication. NPC humanoid combat (e.g. enemy vs enemy) does not appear to encounter this issue unless a player is nearby.