Coins variable will not update

Godot Version


I have a basic farming mechanic implemented and i want to be able to sell the collected crops. When i click the sell button it does everything as intended except update the variable ‘coins’ with the value of the crops multiplied by quantity. currently its set up like this.

coins += potatoes * 2

Do i need to do something differently?

Either potatoes is zero
or your assumption that coins didn’t change is wrong.

No, the syntax is correct. But it’s difficult to find the issue source without seeing more of the code.

I was overlooking something simple. You are correct that it was treating potatoes as 0 because i assigned the variables at the beginning of the script rather than when i would try to sell. I changed when the variables are assigned and it all works properly now