how would i detect if i took damage?
✓ ANSWER ACCEPTED
how would i detect if i took damage?
2 answers
✓ Accepted answer
You would need to use :GetPropertyChangedSignal()
local health = 100
player.Character.Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
if player.Character.Humanoid.Health < health then
-- code goes here
end
health = player.Character.Humanoid.Health
end)
This will only fire if the humanoid health is LOWERED (aka damaged).
You could also do
Humanoid.HealthChanged:Connect(function()
-- code
end
this way you can fire a function whether the health goes up or down
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
ah ok tq