the money must set when a player login not when he join 
function onPlayerQuit ( ) 
      -- when a player leaves, store his current money amount in his account data 
      local playeraccount = getClientAccount ( source ) 
      -- check if the account is a guest account or not 
      if not isGuestAccount( playeraccount ) then 
            local playermoney = getPlayerMoney ( source ) 
            local suc = setAccountData ( playeraccount, "money", playermoney ) 
      end 
end 
addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) 
  
function onPlayerLogin ( ) 
      -- when a player login, retrieve his money amount from his account data and set it 
      local playeraccount = getClientAccount ( source ) 
      if ( playeraccount ) then 
            local playermoney = getAccountData ( playeraccount, "money" ) 
            if ( playermoney ) then 
                  setPlayerMoney ( source, playermoney ) 
            end 
      end 
end 
addEventHandler ( "onClientLogin", getRootElement ( ), onPlayerLogin )