✓ Accepted answer
Humanoid.Health is a floating-point value, (aka a Number), so it will most likely never be exactly 0. Also, there exists a Died event for Humanoids, so you don't have to check the health at all. GetPlayerFromCharacter is a method of Players, not a Humanoid.
Really, this could be better done using the PlayerAdded and CharacterAdded Events, so I'll give you a fixed version of your code, and a version using those two:
h = script.Parent:FindFirstChild("Humanoid")
if h then
player = Game.Players:GetPlayerFromCharacter(script.Parent.Parent)
if player then
x = player:WaitForChild("Ingame")
h.Died:connect(function()
x.Value = false
end)
end
end
Game.Players.PlayerAdded:connect(function(player)
local x = player:WaitForChild("Ingame")
player.CharacterAdded:connect(function(character)
wait()
character.Humanoid.Died:connect(function()
x.Value = false
end)
end)
end)
2 comments
The statement about "never exactly zero" is not really accurate. Humanoids cannot have negative health, so TakeDamage or even subtracting from Health directly will very likely result in exactly 0, as well as environment deaths like falling or being broken apart.
Thanks for the advice!