Why is my RichTextLabel behaving as if there are two instances of it?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By 029614

I am trying to set up multiplayer for my game, this of course includes a chatbox. After seeing how a few others have done this, I decided to follow along and use a RichTextLabel. the setup is fairly straight forward:

enter image description here

extends Control

onready var chat_log = $VBoxContainer/RichTextLabel
onready var input_label = $VBoxContainer/HBoxContainer/Label
onready var input_field = $VBoxContainer/HBoxContainer/LineEdit

var groups = [
    {'name':'Global', 'color':'#ffffff'},
    {'name':'System', 'color':'#edbd00'},
    {'name':'Party', 'color':'#30f74f'},
    {'name':'Whisper', 'color':'#00ede8'},

var group_index = 0
var player_name = 'Test'
var input_focus = false

func _input(event):
    if event is InputEventKey:
        if event.is_action_released("T") and input_field != get_focus_owner():

func _on_LineEdit_text_entered(new_text):
    var message_info = {
    rpc("add_message", message_info)
    input_field.text = ''

sync func add_message(message_info):
    chat_log.text += '\n'
    chat_log.text += message_info['group'] + '/' + message_info['username'] + ': '
    chat_log.text += message_info['message']

func _on_OptionButton_item_selected(id):
    group_index = id

I would expect the rich text label to properly manage the linecount but for some reason it is stacking different players text on top of one another:
enter image description here
If anyone knows anything about this or what I’m doing wrong, I’d really appreciate the help.

Your code looks fine. Have you made sure that there really is only one RichTextLabel? You can pause the game by pressing F7 and take a look at the remote scene tree.

njamster | 2020-07-27 13:58

enter image description here

This is a snap of the Remote scene tree. I believe there’s only one :S

029614 | 2020-07-27 20:00

Mhm, looks fine as well. Can you upload an example project? I cannot reproduce your issue.

njamster | 2020-07-27 20:21


I am currently working off of the branch ‘Experimental’

ChatBox is found under res://Player/PlayerGUI/ChatBox

029614 | 2020-07-27 21:11