how can I ceep position z on 0

When I spawn object position z go -8000 and go at the camera.

spawn code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DeatHoleScript : MonoBehaviour
{

[SerializeField]Transform spawnPoint;
void OnCollisionEnter2D(Collision2D col)
{
    if(col.transform.CompareTag("Player"))
    {
        
        col.transform.position = spawnPoint.position;
        
    }
}

}

if(col.transform.tag == “Player”)
{
Vector3 pos = spawnPoint.position;
pos.z = 0;
col.transform.position = pos;
}