Client is spawning but Host isn't

Hello everyone,

I’m a new developer currently working with Netcode for a multiplayer game. I’m trying to implement a feature in my third-person shooter (TPS) where all players (clients) spawn from a certain height, creating the effect of players descending from the sky. I’m using two variables, positionRangeUpwards and positionRangeUpwards2, to determine the range of the spawn height.

However, I’m encountering a few issues:

  • When I enter the game as a host, the falling doesn’t work, although it works correctly for the clients.
  • When playing with exactly four players, the spawn behavior becomes erratic. Some players spawn from the sky as intended, while others spawn directly on the ground.

I’d appreciate any advice or suggestions on how to resolve these problems. Thank you!

Note: I’ve implemented that logic in the UpdatePosServerRpc() and which is handled in the OnNetworkSpawn().
The code is:
```csharp
**using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
using Unity.Netcode;
using UnityEngine;

public class ThirdpersonMovementNet : NetworkBehaviour
{
public CharacterController controller;
public Transform cam;
public float speed = 6f;
public float turnSmoothTime = 0.1f;
private float turnSmoothVelocity;

[SerializeField] private float positionRange = 3f;
[SerializeField] private float positionRangeUpwards = 1082.0626f;
[SerializeField] private float positionRangeUpwards2 = 682.0626f;

[SerializeField] private float gravity = -9.81f;
[SerializeField] private float jumpHeight = 1.0f;
private Vector3 velocity;
private bool isGrounded;


public Transform groundCheck;
public float groundDistance = 0.4f;
public LayerMask groundMask;


public override void OnNetworkSpawn()
{

    if (IsClient || IsHost)
    {
        UpdatePosServerRpc();
    }



}


private void Start()
{

    Cursor.lockState = CursorLockMode.Locked;
   
}
void Update()
{
    if (!IsOwner) return;


    isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);

    if (isGrounded && velocity.y < 0)
    {
        velocity.y = -2f;
    }

    float horizontal = Input.GetAxisRaw("Horizontal");
    float vertical = Input.GetAxisRaw("Vertical");

    Vector3 dir = new Vector3(horizontal, 0f, vertical).normalized;

    if (dir.magnitude >= 0.1f)
    {
        float targetAngle = Mathf.Atan2(dir.x, dir.z) * Mathf.Rad2Deg + cam.eulerAngles.y;
        float angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnSmoothVelocity, turnSmoothTime);
        transform.rotation = Quaternion.Euler(0f, angle, 0f);
        Vector3 moveDir = Quaternion.Euler(0f, targetAngle, 0f) * Vector3.forward;
        controller.Move(moveDir.normalized * speed * Time.deltaTime);
    }

    if (isGrounded && Input.GetButtonDown("Jump"))
    {
        velocity.y = Mathf.Sqrt(jumpHeight * -6f * gravity);
    }

    velocity.y += gravity * Time.deltaTime;
    controller.Move(velocity * Time.deltaTime);
}

[ServerRpc(RequireOwnership = false)]
private void UpdatePosServerRpc()
{
    transform.position = new Vector3(Random.Range(positionRange, -positionRange), Random.Range(positionRangeUpwards, positionRangeUpwards2), Random.Range(positionRange, -positionRange));
    transform.rotation = Quaternion.Euler(0, 180, 0);
}

}**
```