Help with Level Changing

Godot Version

4.2

Question

Hello, I need help with level changing. So I need to automatically change the level to a scene using a variable that gets changed every time you beat a level. So I basically have a global level variable and I want to join it with text but I don’t know how to do that in code. Here’s what I’m trying to do:

var level = 1

get_tree().change_scene_to_file("res://scenes/level_" + level + ".tscn")

you should turn the level into string

1 Like

Thank you

get_tree().change_scene_to_file("res://scenes/level_" + str(level) + ".tscn")

2 Likes