Raycast Destroy(hit.collider.gameObject); (Still need help)

Hi,i want my player destroys on raycast,my first time working with raycast,so i just need script,i want my player destroys when he touches raycast,like:

if (hit.collider.gameObject.tag == "Player")
      Destroy(hit.collider.gameObject);

Can someone please help me,been trying everything…Please someone help me…Ill be very thankful.

using UnityEngine;
using System.Collections;

public class testDestroy : MonoBehaviour {

    private float distance = 100.0f;
    
     void Update(){
     Ray ray = new Ray(transform.position,transform.forward);
     RaycastHit hit;
     if (Physics.Raycast (ray,out hit,distance))
     {
     Destroy(hit.collider.GameObject);
     }
     }
}