When i try to teleport every player on start of the game it only teleports the player who clicked start button

Please help i’m stuck with this problem

I’m trying to make a button, that starts the game when pressed

After the game starts i want every player to be teleported, and when the host preses the start button the funtcion responsible for this is called for every player, but only the host gets teleported

I’ve tried making the client use the button (normally only host sees it) and it’s the same, but now only the client who clicked the button gets teleported

It’s like the function is attached to the player who started the game and thus the function cannot move other players

This is the function that teleports player:

private GameObject mapSpawn;

public void MapTeleport(GameObject player)
    mapSpawn = GameObject.FindGameObjectWithTag("MapSpawn");
    player.transform.position = mapSpawn.transform.position;
    Debug.Log($"Teleport {player}");

And this is the function that is attached to the button:

[SerializeField] private GameObject mapSpawn;
private GameObject[] players;

void StartGame()
    players = GameObject.FindGameObjectsWithTag("Player");
    for(int i = 0; i<players.Length;i++)
        Debug.Log($"Teleported player: {i} {players[i].name}");

I will be thankful for any form of help