Why can not bullet hit player now?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class vurucu : MonoBehaviour
{
    public Transform hedef;
    void Awake()
    {
        hedef = GameObject.FindGameObjectWithTag("Player").transform;
    }

    void Update()
    {
        transform.LookAt(hedef);
       
        transform.position = Vector2.MoveTowards(transform.position, hedef.position, 10f * Time.deltaTime); //Buraya doğru gidecek.
    }
    void OnTriggerEnter2D(Collider2D carpismis)
    {
        if(carpismis.gameObject.tag=="Player")
        {
            Debug.Log("Vurdum onu");

            carpismis.gameObject.GetComponent<Yara>().canHasari(10f); //10f can hasarı olacak.
        }
    }
}

Man you again …you need to do it better explain a bit more of what happening…and what do you want

1 Like

didn’t you use vector3 lerp on the previous version of this scripts

This is a bullet script.
The bullet can’t hit player now.
I want to the bullet can hit player.

No. That is a different script.
Just, variables were similar

Since you looking at target on update you could just use Translate with forward directions

I understood.I hope script will run.