Percentage issue

Soo i am trying to do a rebirth system, whenever a button is pressed it should add some % based on their rebirth, but i am getting infs or huge numbers. So i need to know how to turn let’s say 61 into 100% and then piece it into 61 parts


image

“So i need to know how to turn let’s say 61 into 100% and then piece it into 61 parts” is 100/61, each part is now ~1.639%. (Sorry If I didn’t understand your question)

1 Like

To turn the number 61 into 100% you can do the following:

( currentNumber / maxNumber ) * 100

( 24 / 61 ) * 100 -- This is equal to 61 being max number, and 24 being the amount of "something" ouf the the maxNumber
-- It is equal to 39.3%

Yeah, i meant that the base is 61 pieces, but for visual effects i needed to make 61 into 100% and split it so when 61 buttons get pressed, it’s gonna be 100%

The reason why you are getting huge numbers like “inf” its because you’re doing this 100 / 0 which returns Undefined (Infinity) can you provide the code here so we can help you with more ease?

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