I am trying to detect when a certain player dies but because the humanoid is deleted it doesn’t fire.
for _,colony in pairs(ants:GetChildren()) do
colony.Queen.ChildAdded:Connect(function(queen)
local player = Players:GetPlayerFromCharacter(queen)
local humanoid = queen.Humanoid
humanoid.HealthChanged:Connect(function()
local HPercentage = (humanoid.Health / humanoid.MaxHealth) * 100
print(HPercentage)
if humanoid.Health <= 0 then
print(player)
end
end)
end)