reset the ball in football game..

i am working on a fooball game and i am trying to write the script to re spawn the ball after player kicks the ball…
following is the script i wrote but its not working…can any one help me to find the mistake in this script…
the ball is applied rigidbody.

using UnityEngine;

using System.Collections;

public class BallSpawnTest : MonoBehaviour
{

private Vector3 initialPos; // Hold the ball’s initial position, and reset it’s position to this after every kick

private const float		KICK_SEQUENCE_TIME = 3.0f;		// Time from kick start until the game is reset
	// Timer to make sure we only use the first collision detected

// Called when the game starts
void Start()
{
	// Remeber the ball's initial position. Later we will use it to restore the ball after every kick
	initialPos = transform.position;
}

private IEnumerator RestartBall()
{

// Wait a few seconds for the kick to end and the wall to come crashing down before resetting the game

	yield return new WaitForSeconds(KICK_SEQUENCE_TIME);

	Debug.Log("function called");

	print("this function was called");

	// Reposition the ball at it's initial place

	transform.position = initialPos;
	

	// Cancel all previous forces to keep the ball still

	rigidbody.velocity = Vector3.zero;

	rigidbody.angularVelocity = Vector3.zero;
	
}

}

You’re not actually starting the RestartBall coroutine.

You need to add StartCoroutine(RestartBall()); to your code somewhere. If you are going to have a Kick function, this would be a great place to fire off the coroutine.

Something like:

public void OnClick()
{
	rigidbody.AddForce(new Vector3(1000,300,0));
	StopAllCoroutines();
	StartCoroutine(RestartBall());
}