How do you set speed on a raycast?

Sorry for caps.
Anyways im trying to make a private multiplayer FPS and ive run into an issue. im creating the shooting script but theres a problem. in my script i shoot a raycast and instantiate a bullet at the same time. the problem is the raycast is hitting the previously fired bullet and creating a bullethole in midair. my question is how would i be able to set the speed of the raycast to match the speed of the bullet?


Gun:using UnityEngine;
using System.Collections;

public class Gunattempt : MonoBehaviour {
public GameObject Bullet;
public GameObject bullethole;
public GameObject bulletspawnpoint;
public AudioClip shotsound;
public float delaytime;
private float counter = 0f;
public float range = 100f;

void FixedUpdate(){
	if(Input.GetKey(KeyCode.Mouse0) && counter > delaytime){
		Instantiate(Bullet, GameObject.Find("bulletspawnpoint").transform.position, transform.rotation);
		AudioSource.PlayClipAtPoint(shotsound, transform.position);
		counter = 0;

		RaycastHit hit;
		Ray ray = new Ray(GameObject.Find("bulletspawnpoint").transform.position, transform.forward * -1);
		if(Physics.Raycast(ray, out hit, range)){
			Instantiate(bullethole, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal));
	counter += Time.deltaTime;



using UnityEngine;
using System.Collections;

public class MoveBullet : MonoBehaviour {

public float speed = 1f;

void Start ()	
	Destroy(gameObject, 5f); //Delete the bullet after 5 seconds

void Update ()	
	transform.Translate(0, 0, speed);


Rays are cast instantly in the given direction and distance. They don’t move like bullets.
Following image might help:

  1. If you don’t want your ray to hit Bullet. You can ignore bullet’s layer in raycast. Using LayerMask parameter in Physics.Raycast method.
  2. And i suppose your bullets have collider too. So why don’t you use OnTriggerEnter to instantiate bullethole.