Variable = Money?

So I'm using a script and I wanted it to access the amount of cash the party had (its a game that costs money to play) but i could only get it to access variables, is it possible to have a script call or w/e that will make a certain variable become equal to the amount of money the party has?
$gameVariables.setValue(variable id, $gameParty.gold());


Should work, haven't tested it.
I've moved this thread to Learning Javascript. Please be sure to post your threads in the correct forum next time. Thank you.
$gameVariables.setValue(variable id, $gameParty.gold());


Should work, haven't tested it.

Thanks, that worked!

I've moved this thread to Learning Javascript. Please be sure to post your threads in the correct forum next time. Thank you.

Sorry, I didn't know that forum existed, I'll remember next time!

Original thread: https://forums.rpgmakerweb.com/threads/variable-money.62588/