The object of type GameObject has been destroyed but you are still trying to access it

I am making a 3d game and i made it so whenever the player collides with a object tagged “walls”. he gets turned off and the camera, you lose,text, and retry button get activated. but something kinda broke and whenever i die and click the retry button the error comes and it wont let me retry. what is supposed to happen is that i get teleported back to spawn and the other things get turned off again. im new to coding so idk what this is.

here is the error:---------------------------------------------------

MissingReferenceException: The object of type ‘GameObject’ has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
button.Update () (at Assets/Scripts/button.cs:23)

here is the button script:-----------------------------------------

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

public class button : MonoBehaviour
{
    public GameObject player;
    public GameObject deadcam;
    public GameObject deadtext;


    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if(Input.GetMouseButtonDown(0))
        {
            player.transform.position = new Vector3(78.3f, 1.55f, 0f);

            player.SetActive(true);

            deadcam.SetActive(false);

            deadtext.SetActive(false);

            gameObject.SetActive(false);
        }
    }
}

and here is the player script:

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

public class movment : MonoBehaviour
{
    float xInput;
    float zInput;

    public float speed;

    Rigidbody rb;

    public GameObject winText;

    public GameObject deadCam;
    public GameObject deadText;
    public GameObject button;




    // Start is called before the first frame update
    void Start()
    {
        rb = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {

        xInput = Input.GetAxis("Horizontal");
        zInput = Input.GetAxis("Vertical");

        rb.AddForce(xInput * speed,0,zInput * speed);

        if(Input.GetKeyDown(KeyCode.Space))
        {
            rb.AddForce(Vector3.up * 200);
        }

       
            }
        void OnCollisionEnter(Collision collision)
        {
            if(collision.gameObject.tag == "Walls")
            {
                Destroy(gameObject);

                gameObject.SetActive(false);


                deadCam.SetActive(true);
                deadText.SetActive(true);
                button.SetActive(true);
        }
        
            if(collision.gameObject.tag == "Win")
            {
                Destroy(collision.gameObject);

                winText.SetActive(true);

               

                //SceneManager.LoadScene("level2");
        }


        }
       
}

ok turns out it was the dumbest thing ever. in my player script i said that if game object collides with an object tagged wall he will get “DESTROYED” but then if i click retry its supposed to set him active. the wrong thing was that i said to “destroy” him, i was supposed to set his active to false" and not destroy him. now its working perfectly so if you have this problem check if you are destroying something and then setting it active instead of setting it to false. and dont give up on your project hope this helps someone. this was kinda just a dumb mistake of me but yeah.

explained it already. works for me