Godot Version
4.2.1
Question
I am trying to do an RPC call but I keep getting this error:
E 0:00:11:0787 multiplayer_manager.gd:55 @ _add_player_to_game(): RPC ‘set_player_name’ on yourself is not allowed by selected mode.
I am trying to call a function on a node in my multiplayer manager. It looks like this:
func _add_player_to_game(id: int):
print("Player %s joined the game!" % id)
var player_to_add = multiplayer_scene.instantiate()
player_to_add.player_id = id
player_to_add.name = str(id)
_players_spawn_node.add_child(player_to_add, true)
player_to_add.set_player_name.rpc_id(id, PLAYER_NAME)
Here is what I’ve got setup on my ‘Player’ character
@rpc("any_peer")
func set_player_name(new_name:String):
player_name.text = new_name
I am not entirely sure why I am getting the aforementioned error though.
Thanks