I added both an identifier label above each head and a simple chat functionality to the Lobby. This was quite easy but changing scenes creashes the game. I guess that Godot (Engine) doesn’t like that as switching scripts redoes the whole thing.
@rpc("any_peer", "unreliable_ordered")
func _on_line_edit_text_submitted(new_text, origin = true):
if len(new_text) < 1:
return
var who = multiplayer.get_unique_id()
set_multiplayer_authority(who)
if origin:
new_text = str(who) + ": " + new_text + "\n"
$Control/Panel/RichTextLabel.text += new_text
$Control/LineEdit.text = ""
if origin: # only the original sender tells the peers
rpc("_on_line_edit_text_submitted", new_text, false)
The trick wswas to use a variazble to see if the sender was the the origin instead of a peer,