so, now i got another problem…
if i want to ask the question to the “AI”, i can click a button or press enter.
but the if statement just gets called if you press the button, not if you you press enter.
this is my code:
func _process(_delta):
if Input.is_action_just_pressed(“enter”):
$Labelperson.text = $TextEdit.text
$TextEdit.text = “”
if $Labelperson.text == "apple":
$LabelAI.text = "ok..."
pass
Your code seems to be right. There might be some other errors. So try adding both enter keys in the input map for “enter” event. Cross check spelling of enter in both from input event and from your code. And remember “apple” and “Apple” are both different strings.
If still it don’t work then add some print() like "enter key was pressed" , "if statement worked" etc. to check which part of code did not worked. And then act accordingly.