im making a tycoon style game, if you have every played one before you would know that some numbers get really big, but normally games have a way of abreaviating numbers so they dont take up the entire screen. im trying to do that, i tried doing:

if money < 1000:
	$Control/cash.text = "$" + str(money)
elif money >= 1000:
	$Control/cash.text = "$" + str(money/1000) + "K"
elif money >= 1000000:
	$Control/cash.text = "$" + str(money/1000000) + "M"

but this did not work like i wanted it to (the numbers were the same but the decimal place was moved)
any ideas on how i can get the working?

Sounds like money is float type. You want int instead.

    Zini yes the money var is a float, but i still want some decimals for when you just get to a bigger number (ex: 1.35M)

    Never ever use float for monetary values. That is just a bad idea, considering the lack of precision that can result from float rounding.

    Assuming you are using ints you could use something like this to get an output like 1.35M:

    $Control/cash.text = "$%d.%d%dM" % [money/1000000, (money/100000)%10, (money/10000)%10]

    Even if monetary values are stored as int or String, they could still be converted to float for the purpose of displaying an approximate value.

    var money: float = 123456789.98
    print_debug("$%.2fM" % (money/1000000.0)) # prints $123.46M

    https://docs.godotengine.org/en/4.1/tutorials/scripting/gdscript/gdscript_format_string.html

      DaveTheCoder this works for one interval (1000) but it does not switch farther than K (ex: 1011.00k)

      	if money < 1000:
      		$Control/cash.text = "$" + str(money)
      	elif money >= 1000:
      		$Control/cash.text = ("$%.2fk" % (money/1000.0))  #works
      	elif money >= 1000000:
      		$Control/cash.text = ("$%.2fM" % (money/1000000.0)) #does not

      The second elif statement is never entered, since with money = 1000000 the condition money >= 1000 is definitely true.

      Don't mix up < and >= in a chain of conditionals like this. You can fix the code by replacing the second condition with money < 1000000 and the third with a simple condition-less else:

        Or reverse the order of the conditions.

        if money >= 1000000.0:
                ...
        elif money >= 1000.0:
                ...
        else:
                ...

        Zini so new problem, the numbers after the decimal point are always 00, (ex: 1700000 -> 1.00M)

        if money < 1000.0:
        	$Control/cash.text = "$" + str(money)
        elif money >= 1000 and money < 1000000:
        	$Control/cash.text = ("$%.2fK" % (money/1000)) 
        elif money >= 1000000 and money < 1000000000:
        	$Control/cash.text = ("$%.2fM" % (money/1000000))

        Is money declared as a float?
        var money: float

        I don't trust code that fails to use static typing.