Use Tween to change variable?

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

I’m working on a shop for my game. Basically, I want the currency counter to match the player’s current max currency whenever a purchase is made, taking the same amount of time to count down regardless of how much is spent. I thought I could do this with a tween but it’s currently not working.

if next and Input.is_action_just_pressed("jump"):
				#Start tween for the screw countdown
				sound('buy')
				global.bolts -= prices[shop_pos]
				
				if global.bolts != screws:
					$graphic/spawn_tiles/shop/countdown.interpolate_property(self, screws, screws, global.bolts, 0.5, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
					$graphic/spawn_tiles/shop/countdown.start()
:bust_in_silhouette: Reply From: Wakatta

Change the second var to a string (nodePath) of the property you’re trying to change

$graphic/spawn_tiles/shop/countdown.interpolate_property(self, "screws", screws, global.bolts, 0.5, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)