projectile script not working

hello whoever is reading this,
i need some help.
i’m trying to make my players bullets disappear when they reach the cursor.
i wrote this:

void Update(){
if(transform.position == targets){
Destroy(gameObject);
}
}

Hello! Firstly, let me point you towards the guide for using script tags . It helps make your code easier to read for people helping you.

The code you’ve provided isn’t very obvious as to how it works in the grand scheme of things. Could you explain a bit more about what objects this script is attached to? What is the targets variable in this case?

1 Like

Comparing vector3’s exactly to each other is not a great idea. You will probably want to check if they are within a certain range, but it is hard to tell what would work best without knowing much about your game.