Send information from one player to another. Unity Multiplayer

I have a player log in with credentials (user name and password), then once they are successfully logged in, other information fields on a script on their player object are filled by my database. I have made it so that if I click on a player a player information box pops up on my screen. I know how to fill the text boxes on the pop up, but how do I fill it with their information? I tried to use RPCs but that didn’t work and I am fairly sure they are depreciated now…

Please help.

Came across this info

If the information is stored on a component of the player, you can just use a raycasting setup to get that player’s collider. So here’s how it works in English:

Player A clicks on his screen while his mouse is over Player B.

Player A fires a ray via script at Player B.

Player A’s ray hits Player B with said ray, and his [Player A] script returns Player B’s collider.

Player A’s script converts the returned collider to the collider’s gameObject, and then to a component.

Player A gets the component “TheOtherPlayerScript” and then accesses a public variable to populate text objects.

And in script…

void Update () {
		void GetSelection() {
			// Use Input.GetKeyDown() for single clicks
			Ray ray;
			RaycastHit hit;
				// Reset ray with new mouse position
				ray = Camera.main.ScreenPointToRay(Input.mousePosition); 
				if(Physics.Raycast(ray, out hit)) {
				TheOtherPlayerScript script = hit.collider.gameObject.GetComponent<TheOtherPlayerScript>();
				//Access the public variables from here and you're all set.