Hello, iv heard about humanoid:TakeDamage(), but is there something like humanoid:AddHealth? I know i can still do humanoid.health = humanoid.Health + number, but its the same for takedamage, but takedamage() is faster to write, is can i do the same with adding health?
Is there an opposite technique of humanoid:TakeDamage()?
2 answers
Like @theking48989987 said, TakeDamage() takes any number, positive or negative. If the number given is negative, the Humanoid will be healed by that amount of Health:
local hum = game.Players.LocalPlayer.Character.Humanoid
hum:TakeDamage(-10) -- Heals 10 HP
However, TakeDamage() is unique about this. There is a bug that enables you to surpass the MaxHealth of the Humanoid using TakeDamage():
hum:TakeDamage(-100) -- If the Humanoid already has 100 HP, they'll surpass their 100 HP limit and they will have 200 HP
By what I know, this bug hasn't been fixed but it is indeed a unique bug.
2 comments
Because of the weird bug you described, I would recommend to just increment the Health field value by whatever amount you desire. For example, Humanoid.Health = Humanoid.Health + 1. I wouldn't use TakeDamage for this.
yeah that's how you prevent it from happening, I know
yes, it works like humanoid:AddHealth() ex:
game.Players.LocalPlayer.Character.Humanoid:TakeDamage(60)
then the humanoid has health 40
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
IM ON, ok so its easy, make it a negative number, for example, humanoid:TakeDamage(-1) will add 1 health. its just math, take away a negative number is like adding.
TakeDamage can take in negative numbers