I am making a game where a plane travels and terrain generates but I have a problem.

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

extends Spatial

func _ready():

if get_node('KinematicBody').Vector3(10, 0, 0):
	var terrain = load('res://Terrain_grass.tscn')
	terrain.duplicate()
	printraw('Mesh duplicated')
	var terrain_position = Vector3()
	pass

the error “Attempt to call function ‘vector3’ in base ‘null instance’ on null instance” pops up.
sorry but I’m new here, so any help will be very much appreciated!

:bust_in_silhouette: Reply From: gmaps

Based on your input, I can say that get_node does not find KinematicBody. Thus it returns null. And then youre trying to call Vector3 on null. So first check if kinematic body really is a child of the spatial node where you bound this script. Second thing; what is the first line trying to achieve? 3. You dont need the pass at the end. Pass is literaly „do nothing“ clause just bloating your code.