I got an error and i'm confused

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

I got this error from a tutorial : E 0:00:00:0902 Condition ’ _debug_parse_err_line >= 0 ’ is true. returned: __null
modules/gdscript/gdscript_editor.cpp:330 @ debug_get_stack_level_instance()

here is the code:

extends Node

class_name Weapon

export var fire_rate = 0.25
export var clip_size = 5
export var reload_rate = 1

onready var ammo_label = $"/root/World/UI/Label"
onready var raycast = $"../Head/Camera/RayCast"
var current_ammo = clip_size
var can_fire = true
var reloading = false


func _process(delta):
	ammo_label.set_text("%d / %d" % [currrent_ammo, clip_size]) 
	
	if Input.is_action_just_pressed("primary_mouse") and can_fire:
		if current_ammo > 0 and not reloading:
			print("fired weapon")
			check_collision()
			can_fire = false
			current_ammo -= 1
			
			yield(get_tree().create_timer(fire_rate),"timeout")
			
			can_fire = true
		elif not reloading:
			print("Reloading")
			reloading = true
			yield(get_tree().create_timer(reload_rate),"timeout")
			current_ammo = clip_size
			reloading = false
			print("Reloaded")

func check_collision():
	print("collison check")
	if raycast.is_colliding():
		print("colliding")
		var collider = raycast.get_collider()
		if collider.is_in_group("Enemies"):
			collider.queue_free()
			print("Killed" + collider.name)

the slanted words are wher _ should be

The error is a typo in your code, but it’s impossible to tell what it is because your code formatting is completely messed up from copying it in here as text.

When editing a post here, you can click the “Code Sample” button to format code correctly.

kidscancode | 2020-01-16 00:13

Also, note that if you have a code error, it will be shown in red in the Script Editor of the Godot window.

kidscancode | 2020-01-16 00:14

:bust_in_silhouette: Reply From: Zylann
ammo_label.set_text("%d / %d" % [currrent_ammo, clip_size]) 

You mispelled current_ammo. I found it by copying your code into an empty project, and the script editor raised it straight away.

the slanted words are wher _ should be

As I said here as well, it’s not enough. After you pasted your code, select it all, and click the “Code Sample” button above the text field. Or before pasting it, indent it by 1 tab in a text editor.