Getting an error to do with a Multiplayer Syncronizer not being found

Godot Version

4.2.2

Question

I’m getting this error

E 0:00:12:0305 Node::get_node: Node not found: “Tavern/1304113874/MultiplayerSynchronizer” (relative to “/root”).
<C++ Error> Method/function failed. Returning: nullptr
<C++ Source> scene\main\node.cpp:1652 @ Node::get_node()

it only ever happens when a player joins late and fixes itself when players shift from the tavern to a quest, it’s really odd and not a huge issue but it’s annoying for the players to be desynced like this in the hub world when someone joins late

and when I say joins late I mean after the host has pressed play and everyone has spawned in

This is my player spawning script:

	if Global.is_multiplayer == true:
		index = 0
		for i in GlobalMissionManager.Players:
			if has_node(str(i)):
				pass
			else:
				Players_Total = Players_Total + 1
				var currentPlayer = Lost_Soul.instantiate()
				currentPlayer.name = str(GlobalMissionManager.Players[i].id)
				currentPlayer.Username = GlobalMissionManager.Players[i].name
				add_child(currentPlayer)
				for spawn in get_tree().get_nodes_in_group("PlayerSpawnPoint"):
					if spawn.name == str(index):
						currentPlayer.global_position = spawn.global_position
				index += 1

Is there any way to fix this or will I have to make a workaround?

1 Like

I do want to add that when I am testing the game the nodes are infact there in the remote section of the engine of all of the clients and the host, so I have no clue as to what could be causing it

By adding a delay

func _add_player(id: int):
	await get_tree().create_timer(0.1).timeout
	if Global.is_multiplayer == true:
		index = 0
		for i in GlobalMissionManager.Players:
			if has_node(str(i)):
				pass
			else:
				Players_Total = Players_Total + 1
				var currentPlayer = Lost_Soul.instantiate()
				currentPlayer.name = str(GlobalMissionManager.Players[i].id)
				currentPlayer.Username = GlobalMissionManager.Players[i].name
				add_child(currentPlayer)
				for spawn in get_tree().get_nodes_in_group("PlayerSpawnPoint"):
					if spawn.name == str(index):
						currentPlayer.global_position = spawn.global_position
				index += 1

it allows the already connected players to see the newly connected player, however the newly connected player still doesn’t sync properly with the other two

1 Like