I'm creating a bit of a "bleeding" script, and i'm looking for the script to fire every time the target takes damage. Currently, the script fires until the target reaches max health. I'm guessing this is something to do with health regen? Here's the block of code, i'm still pretty new to scripting, and if there's any better way out there I would be deeply greatful. Here's the enclosed function:
Definition:
local function damage(severity,lethality)
script.Parent.Rate = severity
if humanoid.Health > 0 then
wait(0.5)
else
script.Parent.Rate = 0
script.Parent.Size = NumberSequence.new(lethality)
end
end
Called:
humanoid.HealthChanged:Connect(function()
damage(12,0.1)
end)
