function updateBalance(uint id, uint balance) public {
users[id].balance = balance;
}
The ‘User memory user = users[id]’ creates a new temporary variable called user with a copy of the information stored at users[id]. updating the balance of user now just updates the balance of the temporary variable, not the balance of the state variable users. My solution was just to reference the state variable directly.