0 votes

What node is used for text input?

The player should enter the key and click the button to confirm and the script will run:

var KEY = "CorrectKey"

func _on_Button_pressed():
    if KEY == "CorrectKey":
in Engine by (321 points)

1 Answer

0 votes
Best answer

Hello, for text input is used nodes LineEdit a TextEdit. In your situation probably more like use LineEdit.

Code will look something like this:
func onButtonpressed():
if $"LineEdit".text == "Abcd": (Eventual using get

I hope it will help you (:

by (263 points)
edited by
func _on_Button_pressed():

    if $LineEdit.text == "password":

Worked like a charm. Thanks!

Of course! I forgot ".text" in my code, sorry.
Thanks, I repair it (:

I'm glad, I helped you.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.