Can't add Rigidbody component because collision prevents it

In my script, whenever I hit a trigger with the right tag, I destroy the rigidbody for the player. I want the player get his rigidbody back by pressing a button and leap away from the trigger. The problem is because the player is still colliding with the trigger, I can’t add the rigidbody back. How do I add a rigidbody even when the trigger will destroy it?

set the layers on the collider of this object to ignore the triggers layer so it will not destroy it right away again, fire it out and then change the layer back

You can use a boolean flag to indicate when the trigger can destroy the rigidbody - clear it when the rigidbody is destroyed, and set it when the player left the trigger:

private var canKill = true;

function OnTriggerEnter(x:Collider){

  if (canKill && x.tag == "???"){
    canKill = false;

function OnTriggerExit(){

  canKill = true;