Help please! Whats wrong with this code?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Terraxin0_0

var spawntime = 3.0
var Apple = preload (“res://Apple.tscn”)

func _process(spawntime):
var a = Apple.instance()
var pos = Vector2(rand_range(100, 200), rand_range(-150, 0))

a.position = pos
add_child(a)
:bust_in_silhouette: Reply From: barbaros

you have to add the node to the tree first, and then set the position