(Bits / Capacity) * 100 is apparently 0 even if its not?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MrBucket

My code is suppossed to have a progressbar that will show you how full your storage is, but instead it says that the bits / capacity * 100 is 0, and only changes it to 100% once its at max, and i have no idea why. The code in question:

func _process(delta):
$Label.text = str(Bits)
Second += delta
if Bits > 0:
	$ProgressBar.value = round(Bits / Capacity) * 100
	print(round(Bits / Capacity) * 100)
if Second > 1:
	Second = 0.001
	if Bits < Capacity and Bits + Spark_Gens < Capacity:
		Bits = Bits + Spark_Gens
		if Spark_Gens > 0:
				$AudioStreamPlayer.play()
	else:
		Bits = Capacity
:bust_in_silhouette: Reply From: kidscancode

If Bits and Capacity are integers, then this makes sense.

var a = 1
var b = 2
var c = a / b  # c is 0, because of integer division

If you convert one or both to floats, your result will be a float, ex: float(Bits)