i have some code to spawn a cube on the player when i press R, but whenever i do it just teleports the cube to where the player is instead of spawning a new one. i probably did this wrong, so some help would be apreciated. heres my code:
var cube = load("res://cube.tscn").instance()
func _process(delta):
if Input.is_action_just_pressed("R"):
get_tree().root.add_child(cube)
cube.global_transform = self.global_transform
im pretty new to this so sorry if this is a stupid question