So I have a control node called Chat with a chat script
Inside it I have a TextEdit named ChatBox
And I have a LineEdit named ChatInput
And I of course got a Character2dBody as the player with a player script.
Mult Sync is set up to both the TextEdit.text and even tried with the LineEdit.text
I've got it so the person who sends it can see their message..
And even the print shows the other person can supposedly see whats sent.
But the message itself isn't popping up in the other person's actual chatbox.
The Chat Script
extends Control
@onready var chat_box: TextEdit = $ChatBox #Message
@onready var chat_input: LineEdit = $ChatInput
@onready var but_send: Button = $ButSend
@onready var usrmn = $"../../../../..".name # Replace with player inputted name
@onready var player = $"../../../../.."
func submit() -> void:
_on_but_send_pressed()
func _on_but_send_pressed() -> void:
rpc("msg_rpc", usrmn, chat_input.text)
chat_input.text = ""
@rpc ("any_peer", "call_local")
@warning_ignore("shadowed_variable")
func msg_rpc(usrmn, text):
print("Usrmn: ", usrmn, " Text: ", text)
chat_box.text += str(usrmn, ": ", text, "\n")
chat_box.scroll_vertical = chat_box.get_line_count()```