I cannot modify the humanoid.Health from 1000000000 to 999999970

humanoid.Health from 1000000000 to 999999970 is invalid

the doc:

The number data type, or double, represents a double-precision (64-bit) floating-point number. Numbers can range from -1.7 * 10^308 to 1.7 * 10^308 (around 15 digits of precision, positive or negative).

Sample code:

humanoid.MaxHealth = 1000000000
humanoid.Health = 1000000000
print(humanoid.Health) -- 1000000000
humanoid.Health = 999999970
print(humanoid.Health) -- 1000000000
wait(1)
humanoid.Health = 999999970
print(humanoid.Health) -- 1000000000
wait(1)
humanoid.Health = 999999970
print(humanoid.Health) -- 1000000000

I think your healing script is still enabled, try disabling it:

character:WaitForChild("Health").Disabled = true

I run it in Empty Project and not the player character.just a model with humanoid

What happens if you try
humanoid.Health -= 30 then print it?

same result :joy:

I suspect that humanoid is for some reason internally stored as a 32 bit float??? If you put in 999999936, the next lowest value representable by a 32 bit float, it works just fine.

Here’s a discription:
The Floating-Point Guide - Error Propagation of floating point error.

Wait, I see that @based just posted about that.

thanks~ 999999936 can be work fine

Oh, that’s it! thanks! :smiley::smiley:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.