Ray cast stops working

Im casting a ray and it stops working after it hits one time. I know Player1IsOnTop is set to true. Any help would be wonderful thank you.

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



public class Player1Ray : MonoBehaviour
{
    private Rigidbody rb;
    public Animator animatorController;
    // Start is called before the first frame update
    void Start()
    {
        GameObject.FindWithTag("Player2");
        rb = GetComponent<Rigidbody>();
        GameObject.Find("Player2");
    }
    void FixedUpdate()
    {
        if (gameObject.GetComponent<PlayerMove>().Player1IsOnTop == true)
        {
            RaycastHit hit;
            float distance;
            Vector3 forward = transform.TransformDirection(Vector3.forward) * .00010f;
            Debug.DrawRay(transform.position, forward, Color.green);
            if (Physics.Raycast(transform.position, (forward), out hit))
            {

                distance = hit.distance;
                print(distance + "" + hit.collider.gameObject.name);


                if (hit.collider.gameObject.tag == "Player2")
                {


                    rb.AddForce(transform.up * 25f);
                    if (animatorController)
                    {

                        animatorController.SetBool("Jumping", true);
                    }
                    else animatorController.SetBool("Jumping", false);
                }
            }

Add more debug statements to the code, or set breakpoints, so you can tell how far in the code you’re getting. Debugging this kind of thing generally just means inspecting the state of things and understand what is false when you expected it to be true.

I checked the variable player1isontop and it’s positive at the right time. I have the same script in player2 object and it works fine when player1isontop is false. When variable is set to positive. Ray cast in player object just works once.

I really recommend you just debug the code. Step through the code, see what the current values are, and it should be very easy to understand why it isn’t reaching a particular line of code.