0 votes

I’m trying to make a load screen that in a nutshell has a 5-second cooldown, at the end of the cooldown changes the scene.

    # Remove the current level
    var level = get_node("res://game.tscn")

# Add the next level
    var next_level_resource = load("res://game.tscn")
    var next_level = next_level_resource.instance()

This got me on another post, but it doesn’t work, tells:

"The identifier "root" isn’t declared in the current scope."

I don’t know if it matters that I’m making 2D game.

PS: are the first days I use Godot ;)

Godot version latest
in Engine by (12 points)

1 Answer

0 votes

root isnt availabe in a node. You have to get the root node via:

var root = get_tree().get_root()
# or
var root = get_node("/root")

have a look here for more informations:

by (3,940 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.