Collision on Key press

Im using a scene with a 3rd person controller character and a sphere meant as a football, my objective is to add force to the sphere when I press the RightShift key, I cant get it to work.

Here´s what my script looks like:

using UnityEngine;
using System.Collections;

public class strike : MonoBehaviour
{
	public int speed = 1000;

	void TryHit()
	{
		if(Input.GetKeyDown(KeyCode.RightShift))
			GetComponent<Rigidbody>().AddForce(transform.forward * speed);
	}
} 

Thanks in advance!

One of your reasons could be that the TryHit() method is never being called.
Another reason could be that the game object does not have a Rigidbody attached to it.

You defined the Input condition inside function TryHit which may or may not be called. More importantly, it will be next to impossible to get the input just when the TryHit is called.

What you want to do is Put that code inside the Update() function, which is called every frame. Here you can continuously check whether there was a key press or not.

using UnityEngine;
using System.Collections;
 
 public class strike : MonoBehaviour
 {
     public int speed = 1000;
 
     void Update()
     {
         if(Input.GetKeyDown(KeyCode.RightShift))
             GetComponent<Rigidbody>().AddForce(transform.forward * speed);
     }
 }