I'm trying to make a script where the dummy takes 50 damage every second in a loop but Takedamage doesn't seem to work, does anybody know why?
Im guessing TakeDamage function is deprecated. But for a safer method, do this:
Humanoid.Health = Humanoid.Health - 50
Also, I think you can try this way if it did not get deprecated yet:
Humanoid:TakeDamage(50)
The difference of them is the first script damages the character even he have forcefield on, while TakeDamage does not.
Here is the baseline of TakeDamage()
(might not be entirely correct):
function Humanoid:TakeDamage(self, hp) self.Health = self.Health - hp end
TakeDamage()
behaves in the exact same manner as health = health - damage
. A value damage
is subtracted from health
, with the lowest possible Health value being 0 under normal circumstances.
The function does not behave differently whatsoever when used on NPCs and Players. Both of their Humanoids will take damage the same way, with no exceptions (if you exclude the Humanoid having 0 Health).
As for your issue, there are a few possibilities as to why the function isn't working:
print()
.