0 votes

Hello, I have a question!
I have two scenes - CharacterCreation.tscn and Game.tscn
In CharacterCreation.tscn I have a LineEdit for input nickname, there is it's code:

extends LineEdit

var Name = "PLAYER"

func ready() -> void:
grab
focus()
connect("textentered", self, "ontextentered")

func onNameInputtextentered(newtext):
Name = new
text

I send this script in autoloading and name it - PlayerNameNODE

In Game.tscn I have a label and there must be player name:

func _ready():
print("Your name is - ", PlayerNameNODE.Name)

But when I'm trying to get varibale from script it takes name from this string

var Name = "PLAYER"

So the name always is "PLAYER", no matter what actual player input.

Godot version 3.3.2 stable
in Engine by (12 points)

1 Answer

0 votes

Hi
first thing that caught my eye

connect("textentered", self, "ontextentered")

func onNameInputtextentered(newtext):

the function name in connect does not match the functions name. This should throw a warning in the debug console.

by (3,932 points)
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.