Godot Version
Godot v4.3
Question
So I made a test function to have a Controi node trigger a level change
func _process(delta:float)->void:
mousepos = get_viewport().get_mouse_position()
if Input.is_action_just_pressed("click"): get_parent().changelevel()
and
# Changes the current level to either the next one or the one corresponding to the int entered into the function
func changelevel(dest:int)->void:
if str(dest).is_valid_int(): current_level = dest
else: current_level = current_level+1
get_node("room").free()
add_child(ResourceLoader.load(level[current_level]).instantiate())
print("Changed to level["+str(current_level)+"] = "+level[current_level])
(all level scenes are called βroomβ)