The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

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:
connect("textentered", self, "ontextentered")

func onNameInputtextentered(newtext):
Name = new

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

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 (4,088 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 Frequently asked questions and 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 [email protected] with your username.