Raycast won't work

hi everyone! i’m new to the community and would really like some help with this code because i’m stuck and i can’t find anything online and a frined of my said to me to ask here.

what i’m trying to do in the game is this: When the player point the flashlight on the cube, a Raycast hit the cube and start a simple counter every second that the cube is hit. When the flashlight is not hitting the cube anymore the counter reset.

What is happenig is different in my game. the debug show the counter go up only when i hit the cube but it isn’t increasing evey second and it doesn’t reset when the raycast isn’t hitting the cube.

This is an image frome the scene

and this is the code that isn’t working

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

public class Raycast : MonoBehaviour
{
    bool staColpendoPoss = false;
    float tempoPoss = 0f;
    GameObject luce;
    [SerializeField] float distanzaMassima = 1f;

    void Start()
    {
        luce = GameObject.Find("Light");
    }

    void FixedUpdate()
    {
        Vector3 direzioneRaggio = transform.forward;
        Vector3 posizioneRaggio = transform.position;
        Ray raggio = new Ray(posizioneRaggio, direzioneRaggio);

        RaycastHit colpito;
        if (Physics.Raycast(raggio, out colpito, distanzaMassima))
        {
            if (colpito.collider.CompareTag("Possedibile"))
            {
                // If the raycast hits the tagged object, start the timer
                staColpendoPoss = true;
                Contatore();
            }
        }
        else
        {
            // If the raycast doesn't hit the tagged object, reset the timer
            staColpendoPoss = false;
            tempoPoss = 0f;
        }

        Debug.DrawRay(raggio.origin, raggio.direction * distanzaMassima, Color.red);
    }

    void Contatore()
    {
        if (staColpendoPoss)
        {
            // If the raycast is hitting the tagged object, increment the timer
            tempoPoss ++;
            Debug.Log(tempoPoss);
        }
    }
}

thanks in advance for the help and sorry for the bad english, it isn’t my first language