How do I calculate this math problem?

Hello!
So im currently making a advanced low health sound system which the less health you have. The louder the heartbeat sound gets. And it came me with a problem.
First if the humanoid health is full it will be 100% which is returned as 1.
However when the humanoid health is empty it will be 0% which is returned as 0

If I would put:
script.Parent.HeartHeatSound.Volume = healthpercent
It will play the maximum sound when the player is on full health and mute the sound when the player dies.

How will I calculate it?
Please help!

script.Parent.HeartHeatSound.Volume = 1 - healthpercent

Should do the trick!

1 Like

Thats just a rearrangement of my answer…

Wait I forgot. Im sorry
My bad :rofl: