Change account's money amount

Hello everyone.

I'm working on a game of chance code. There's a code about if player loses game, his/her money will transfer to the bank. And I'm doing this: if user lost, decrease amount of user and increase of amount of bank (user - x, bank + x).

Bank's amount increases, but user's amount doesn't decrease.

Here my code:

const FS = require ('fs')

const File = JSON.parse (FS.readFileSync ('./Data/Amounts.json', 'utf-8'))
var Amount = File []

File [] = Amount -= Y2
File.Bank = File.Bank += Number (Y2)
FS.writeFile ('./Data/Amounts.json', JSON.stringify (File), 'utf-8', Error_ => {
  if (Error_) throw Error_

I’ve solved the problem. Thanks.