Invalid get index 'text' (on base: 'String').

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By RGames
extends Control
var Player_words = []
var Prompt = ["a show" , "adjective" , "verb" , "adjective"]
var Story  ="I like %s cus it's %s ,Ever since my childhood I %s .so im %s"

onready var PlayerText = $VBoxContainer/HBoxContainer/PlayerText
onready var DisplayText =$VBoxContainer/DisplayText

func _ready():
	DisplayText.text="Welcome to LoonyLips,Let's Have a Wonderful Time "
	Check_player_word_length()

func _on_PlayerText_text_entered(new_text): 
	add_to_player_words()

func _on_TextureButton_pressed():
     add_to_player_words()
func add_to_player_words():
	 Player_words.append( PlayerText)
	 DisplayText =""
	 PlayerText.clear()
	 Check_player_word_length()

func Is_story_done():
	return Player_words.size() == Prompt.size()
func Check_player_word_length():
	if Is_story_done():
		tell_story()
	else:
		 prompt_player()
func tell_story():
	DisplayText.text = Story % Prompt
func  prompt_player():
	DisplayText.text +="May I  have  "+ Prompt[Player_words.size()]+" Please?"
:bust_in_silhouette: Reply From: jgodfrey

Instead of blanking out the text as you intended to do, you’re reassigning your DisplayText variable to an empty string here:

DisplayText =""

That should be:

DisplayText.text = ""

Thank you so very Much

RGames | 2022-08-27 15:41