When i shoot the enemy it shows there is an error but i cant find it when it hits the enemy it should show killed enemy

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

extends Node

class_name weapon

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

onready var raycast = $“./Head/Camera/RayCast”
var current_ammo = clip_size
var can_fire = true
var reloading = false

func _process(delta):
if Input.is_action_just_pressed(“primary_fire”) and can_fire:
if current_ammo > 0 and not reloading:
print(“Fired weapon”)
can_fire = false
current_ammo -= 1
check_collision()
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("Reload complete")

func check_collision():
if raycast.is_colliding():
var collider = raycast.get_collider()
if collider.is_in_group(“Enemies”):
collider.queue_free()
print(“Killed” + collider.name)

what does the error say?

umma | 2022-02-04 02:25

Two things to help those trying to help you…

  1. Format your code in the post - it’s hard to read otherwise. To do that, edit your post, select the text that is the code, and press the { } “Code Sample” button in the editor’s toolbar.
  2. You mention you’re getting an error. Please post the error itself and any other relevant info you might have.

jgodfrey | 2022-02-04 14:44