both gameobject destroyed

I’m working on my game and have a script that is supposed to add extra time if an object is destroyed, But i’ve met a problem, both the player and the object is destroyed and no extra time is given :face_with_spiral_eyes: Is there something wrong in the script?

using UnityEngine;
using System.Collections;

public class EkstraTid : MonoBehaviour {
	Tid tid;
	
public int ekstraTid;
private bool _triggered;


void Start ()
	{
		
	}
	
void Update ()
	{
	if (_triggered)
			Destroy(gameObject);
	}
void OnTriggerEnter(Collider other) {
        if (other.gameObject.CompareTag("EkstraTid"))
			tid.tiden += 100f;
			_triggered = true;

            Destroy(other.gameObject);
			print ("object Destroyed");

			}
			}

Edit. Removed some unused lines in script

You place this in Update:

if (_triggered)
            Destroy(gameObject);

Then you set _triggered to be true. You also didn’t assign your tid variable so your extra time will never be added (unless it’s static but I can’t tell from just this script).

Thank you for your help :slight_smile: Removed what was in update and assigned the variable and it worked :slight_smile: