Filed to make the scene load after preload

Godot Version

4.3stable

Question

here i try to make dungune full of room with one node and area3d as door that when player enter it load new room and until player get to finish room see image below for more detils




i fix it it was say the node of level i copy for another level was deleted when the scene was made bucase it for start room and it is copy when i modfy it position it say the olde one godot found is deleted for the quene_free call when i remove it the scene became not try to find that old one hahahahah hahhahahhaha dam bug also the preload break so use load and it work
also this doc in godot explani the error

also the gloabl position was incresing by alot so i made it into poistion and it work here code

extends Node3D


func _on_area_3d_body_entered(body: Node3D) -> void:
	if body.is_in_group("users"):
		choes_room()


#randi_range(1,2)
func choes_room():
	var random_room_number = 2
	match  random_room_number:
		1:
			var target_spown_also_middle_one_of_room: Node3D = $target_spown_also_middle_one_of_room
			var FINISH_ROOM = load("res://forworldroom/finish_room.tscn")
			var FINISH_ROOM_build = FINISH_ROOM.instantiate()
			FINISH_ROOM_build.sposition = target_spown_also_middle_one_of_room.global_position
			FINISH_ROOM_build.transform.basis = target_spown_also_middle_one_of_room.transform.basis
			print_debug("see it two it need one")
			add_sibling(FINISH_ROOM_build)

		2:
			var target_spown_also_middle_one_of_room: Node3D = $target_spown_also_middle_one_of_room
			var SECAND_ROOM = load("res://forworldroom/secaned_secande_room.tscn")
			var SECAND_ROOM_build2 = SECAND_ROOM.instantiate()
			SECAND_ROOM_build2.name = "id3"
			SECAND_ROOM_build2.position = target_spown_also_middle_one_of_room.position + Vector3(0.0,0.0,-50)
			SECAND_ROOM_build2.transform.basis = target_spown_also_middle_one_of_room.transform.basis
			print_debug(SECAND_ROOM_build2.position)
			add_sibling(SECAND_ROOM_build2)

see there page Logic preferences — Godot Engine (stable) documentation in English
but in shot word here is it

Uh oh! This results in an error!

@export var a_building : PackedScene = preload(“office.tscn”)

One must assign constant values to constants. Because load performs a runtime lookup by its very nature, one cannot use it to initialize a constant.

const OfficeScn = load(“res://office.tscn”)

Successfully loads and only when one instantiates the script! Yay!

var office_scn = load(“res://office.tscn”)