So for some reason after i put in some files in, my script no longer works

extends Control

var mortar = preload("res://Scenes/Mortar.tscn") # error on this line 
var player
var rand1
var rand2
var randtim 

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	$AttackTimer.start()
	player = get_tree().get_first_node_in_group("player")


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	rand1 = randi_range(2,-2)
	rand2 = randi_range(2,-2)
	self.position.x += rand1
	self.position.y += rand2


func _on_attack_timer_timeout() -> void:
	if not Enemiesdisabled.enemiesdisabled:
		randtim = randf_range(2,4)
		$AttackTimer.wait_time = randtim
		var m = mortar.instantiate()
		if player.speed > 0:
			m.global_position.x = player.global_position.x + 1600
		elif player.speed < 0:
			m.global_position.x = player.global_position.x + 1600
		else:
			m.global_position.x = player.global_position.x
		$AttackTimer.start()
		m.global_position.y = player.global_position.y
		get_parent().get_parent().add_child(m)
		$AnimationPlayer.play("shoot")
		await get_tree().create_timer(0.3).timeout
		var m1 = mortar.instantiate()
		if player.speed > 0:
			m1.global_position.x = player.global_position.x + 1600
		elif player.speed < 0:
			m1.global_position.x = player.global_position.x + 1600
		else:
			m1.global_position.x = player.global_position.x
		if player.in_air:
			m1.global_position.y = player.global_position.y
		get_parent().get_parent().add_child(m1)
		$AnimationPlayer.play("shoot")

it says that it doesnt preload even tho the path is correct

Can you copy and paste the error message?

You probably shouldn’t preload anyways, only use preload for small resources or scripts, entire scenes can cause recursive issues. You could use load instead; if you get the same error message then try to share your FileSystem panel

And this error occurs when holding crtl and dragging the scene into the script?

ye i tried

heres the error message:

E 0:00:01:962 _on_attack_timer_timeout: Cannot call method ‘instantiate’ on a null value.
mortar_man.gd:31 @ _on_attack_timer_timeout()
mortar_man.gd:31 @ _on_attack_timer_timeout()

That is an error message on line 31, not the line you actually marked for us.
But as @gertkeno suggested, you probably shouldn’t be using preload.