Player bugging around

So I am new to Unity and tried making an online 2d Multiplayer game using Photon Engine. The Character Controller is working fine but I tried adding a magnet to the game. Every Player should be able to activate a magnet and pull the other player towards himself. Until now I just started making the magnet (that's why only one of the two players has the magnet script attached to it and the magnet is active all the time). The script worked fine for a while but now it doesn't anymore (from the perspective of the attracted player it is working but from the perspective of the attracting player the attracted player is bugging around). I would really appreciate it if someone could help me with this problem because I am stuck.
using Photon.Realtime;
using UnityEngine;

public class MagnetP1 : MonoBehaviour
public GameObject player2;
public Transform player2transform;
public Rigidbody2D player2rb;
public float influenceRange;
public float intensity;
public float distanceToPlayer;
Vector2 pullForce;

private void Start()


void Update()

player2 = GameObject.FindGameObjectWithTag("Player2");
player2transform = player2.GetComponent();
player2rb = player2.GetComponent();

distanceToPlayer = Vector2.Distance(player2transform.position, transform.position);
if (distanceToPlayer < influenceRange)
pullForce = (transform.position - player2transform.position).normalized / distanceToPlayer * intensity;
player2rb.AddForce(pullForce, ForceMode2D.Force);

"Player2" is the tag of the second player.