I'm making a combat-type game I want to play a certain animation when a player is hit for a certain amount, yet I can't find a way to measure the damage a humanoid takes at a time.
local humanoid = script.Parent.Humanoid
local fatal_hit = Instance.new("Animation")
fatal_hit.AnimationId = 'rbxassetid://xxxxxxxx'
fatalTrack = script.Parent.Humanoid:LoadAnimation(fatal_hit)
humanoid.Parent.Health:Destroy()
humanoid.HealthChanged:Connect(function(health)
local DMG = health - humanoid.MaxHealth
if DMG >= 70
end)
This obviously won't work, as DMG is just the difference between the health and maxHealth, and will play whenever the health is below 30. Any help would be greatly appreciated. And for some reason, my typing is interpreted as a code block? Not sure how to fix it...

2 comments
Edited for formatting. Removing codeblocks where there shouldn't. Caused by tab'ing or four spaces which gets parsed by markdown interpreter as codeblock.
The damage taken would be the previous amount of health the humanoid had minus the amount of health they currently have. If both numbers are 0 (if the Humanoid is dead), the damage taken is 0.