Hello Godot forums! i am a beginner at Godot and i am trying to check as a player what scene it is on. this is my implementation

extends CharacterBody2D

func _ready():
	var CURSCNDIR = str(get_tree().get_current_scene().get_path())
	if CURSCNDIR == "res://x.tscn":
                 # stuff goes here

idk what's wrong with it

    Thisisdcode maybe just make a variable of scene path in the player and set it when you add player to scene?

    Thisisdcode I think scenes get combined when they are added to the tree, so there just ONE big scene.

    if you need the player to detect areas, you have to use something like Area2D, and when the player enters this area it requests data to this Area2D that belongs to the scene that spawned with it.
    let's say you have a forest scene and a mountains scene, you can put metadata in an Area2D in each with some text, and then request it with get_meta():

    first assign metadata to the Area2D, it's a the bottom of the inspector. let's add a variable "zone" that is String and contains the name of the area. In the forest scene this would be "forest".

    put this Area2D in it's own layer.
    add an Area2D to the player that collides with this layer, and then connect the area entered signal to the script.

    when the player enters this area it will trigger the signal and will execute the function. and then you can request metadata from the collided area body:

    var zone = body.get_meta("zone", "default_text")
    print(zone)

    Thisisdcode just print or use debugger to view the result of CURSCNDIR. You should get a path to the current scene's node, not the physical file path. If you want physical path use get_tree().current_scene.scene_file_path

    extends CharacterBody2D
    
    func _ready():
    	var CURSCNDIR = str(get_tree().get_current_scene().get_path())
            print(CURSCNDIR) # 
    	if CURSCNDIR == "res://x.tscn":
                     # stuff goes here