RPC Random Range Problem

Options
i'm developing a multiplayer card game
. I'm using this script for bot money
But every client gets diffrent numbers. How I can solve this?
my code
using UnityEngine;
using UnityEngine.UI;
using Photon.Pun;
public class auctionM : MonoBehaviourPunCallbacks
{
 public int SetMoney;

   

    PhotonView photonView;

    private void Start()
    {
        photonView = GetComponent<PhotonView>();

        
        if (PhotonNetwork.IsMasterClient)
        {
            int random = Random.Range(12, 60);
            photonView.RPC("SetMoneyF", RpcTarget.All, random );
        }
       
    }

    [PunRPC]
    private void SetMoneyF(int Amount)
    {
        SetMoney= Amount;
    }
}

Comments

  • Try to call RPC SetMoneyF after all the players join the game. Currently its getting called inside Start method, maybe within that time no other clients have joined the game yet.

    If there are multiple instances of auctionM object then SetMoneyF will be called multiple times with different random values