+1 vote

I'm trying to display a var as text in a different node and need the var from the player one

Godot version 3.2.3
in Engine by (26 points)
retagged by

I'm a beginner, so I could easily be wrong, but at the top of the script, where it says "extends 'X' ", you can type in the script you want the variable from.

the extends x is what the script is attached to, so that wouldn't work. Thanks though!

I skipped the Extends Node but I think you can get it.

1 Answer

+1 vote

Get the node that has the variable and then reference it like any other property.

Here's an example:


var property = "some property"


onready var player = $Player
var property = player.property
by (295 points)
edited by

I'm fairly new to Godot, can you explain how I do that? you could just give me an example if you want. Thanks!

Already did. Refresh the page.

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.