Hello I just cant figure out. Im tring to make chat system. But it messages are not being replicated across the clients, even tho all clients receive these messages using print() function.

You can see that the code in the func send_message(_player_name,_player_id, _player_message) gets triggered twice , but the message scene does not gets added - > messages.add_child(new_msg)

chat ui.gd

extends Control
class_name ChatUI
@onready var messages: VBoxContainer = %Messages
@onready var enter_message: LineEdit = %EnterMessage
const MESSAGE_CONTAINER = preload("res://UI/message_container.tscn")
@export var player_data:PlayerData
@onready var scroll_container: ScrollContainer = %ScrollContainer

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	#if not is_multiplayer_authority(): return

	enter_message.hide()
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	pass
func _unhandled_input(event: InputEvent) -> void:
	if not is_multiplayer_authority(): return
	
	if Input.is_action_just_pressed("action_chat"):
		print("chatui: input - ", multiplayer.get_unique_id(), " - ", player_data.player_name)
		if not enter_message.visible:
			enter_message.show()
			enter_message.grab_focus()
			scroll_container.scroll_vertical = scroll_container.get_v_scroll_bar().max_value
			Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
@rpc("any_peer","call_local")			
func send_message(_player_name,_player_id, _player_message):
	
	var new_msg:MessageContainer = MESSAGE_CONTAINER.instantiate()
	new_msg.msg_sender_name = _player_name
	new_msg.msg_text = _player_message
	new_msg.msg_sender_id = _player_id
	var cnt = messages.get_children().size() -1
	new_msg.name =str(cnt)+str("_")+str(_player_id)
	messages.add_child(new_msg)
	
	enter_message.text = ""
	enter_message.release_focus()
	enter_message.hide()
	Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
	scroll_container.scroll_vertical = scroll_container.get_v_scroll_bar().max_value
	#scroll_container.get_v_scroll_bar().max_value
	print("message sent - to : ", multiplayer.get_unique_id(), " from: " , _player_name , " id: ", _player_id , " msg: ", _player_message)
	
	pass


func _on_enter_message_gui_input(event: InputEvent) -> void:
	#if not is_multiplayer_authority(): return
	if Input.is_action_just_pressed("action_chat"):

		if enter_message.text:
			send_message.rpc(player_data.player_name,player_data.id,enter_message.text)
			
		else:
			enter_message.release_focus()
			enter_message.hide()
			scroll_container.scroll_vertical = scroll_container.get_v_scroll_bar().max_value
			Input.mouse_mode = Input.MOUSE_MODE_CAPTURED

			
	pass # Replace with function body.

I dont get it why child is not being added but the print() is getting the correct data..

And i dont get any warning nor errors in the deburger..
I have confirmed that if i make a break point at the messages.add_child() the new_msg object has the correct data.
It just doesnt gets added for the other client that is not sending the message.

    kuligs2 Cant get it to work. Do the chat messages need to live in autoload/global script? Cant wrap my head around why its not creating nodes in the UI even tho the print message works..

    Well, i dont get it.
    Maybe i do..
    Rewritten this thing, just moved to empty project and added the ChatUI control to the world tree node, in the first example the chatui node was a child of player, player child of world.

    And now it works.

    No multiplayer spawners, no convoluted methods. No autoload lists. Just an rpc().

    Am i loosing my mind?