I am getting an error called invalid operands int and nil on operator "-"

Godot Version

Question

It’s usually a good idea to post your code along with the error message, but: The error will point you to a line in your script where you try to subtract two variables (that’s why the “operator” is a minus sign) but only one is a number (an integer), while the other is undefined (i.e. nil). The solution should be obvious: Make sure that isn’t the case!

1 Like