Spawning item multiple times

Godot Version

4.2.2 stable


Hi, I’m new to godot and i’m trying to make an item spawn on a cursor attached to my player node.

extends CanvasLayer

var mynode = preload("res://scenes/trruc.tscn")
@onready var target = $"../CharacterBody3D/Zone"

func _process(delta):
	if Input.is_action_just_pressed("spawn"):

func inst(pos):
	var instance = mynode.instantiate()
	instance.position = pos

The problem is that it works one time then nothing spawns anymore…

Thanks in advance !

What is cible.position?, I think the problem is there, maybe it has same value always so it spawn in same pos, try to use get_global_mouse_position() or get_viewport().get_mouse_position()