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
2 Likes

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

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

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

1 Like

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

1 Like

same result :joy:

1 Like

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.

1 Like

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

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

1 Like

thanks~ 999999936 can be work fine

1 Like

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

2 Likes

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