I need help with random enemy spawning

Question

I am new to coding and Godot. I am copied a random enemy spawner from a 4 year old video by AJ08Coder, but every time I load my project it crashes after my timer times out. and I am getting the error message (invalid assignment of property or key ‘offset’ with value ‘int’ on base object ‘PathFollow2D’), and the error is on line 17. Any help in much appreciated


image

extends Node2D

var enemy = preload("res://enemy.tscn")

func _ready() -> void:
	randomize()
	$Timer.start()





func _on_timer_timeout() -> void:
	var rng = RandomNumberGenerator.new()
	rng.randomize()
	
	$Path2D/PathFollow2D.offset = rng.randi_range(0,7750.04)
	var instantiate = enemy.instantiate()
	
	instantiate.global_position = $Path2D/PathFollow2D/Marker2D.global_position
	add_child(instantiate)


Could you tell us what version of Godot you are using? In the latest version, PathFollow2D doesn’t have an “offset” property. There’s either h_offset or v_offset.

thank you so much that fixed the error.