How do I make pick up item disappear after it is pick up

I have a health pack in my scene . The problem I am having it after the I recharge my health . The health pack is still around . It’s suppose to disappear like the items in my scene and respawn later in the scene. How do I fix this problem ?

Here’s how I’d do it.

I don’t know how your scripts work though but I’ve compiled an example of how I’d do something like this in C#.

My script is attached to the health pack object, and when the player presses E on their keyboard, their health is incremented and the health pack vanishes for 5 seconds before re-appearing.

It contains a boolean variable so we can tell whether or not the health pack is enabled or not. It has a game object variable so we can access the health variable from another script. It has a boolean variable for the timer, and a float variable which is the actual timer.

private bool healthItemEnabled = true; 
public GameObject objectWithHealthScript;
private float timer = 0f; 
private bool timerEnabled = false;

In void update, we’re detecting whether or not the player presses E whilst the health pack is enabled, and if so, it will increment the health variable in the other script and then set the healthItemEnabled variable to false.

We then set the renderer and collider of the health pack to false so the player cannot walk into it or see it in the game.

We then set the timer boolean to true, so the timer can begin.

void Update () {
		
		if (Input.GetKeyDown(KeyCode.E))
		{
			if (healthItemEnabled == true)
			{
				objectWithHealthScript.GetComponent<HealthScript>().healthVariable++;
				
				healthItemEnabled = false;
				
				gameObject.GetComponent<Renderer>().enabled = false;
				
				gameObject.GetComponent<Collider>().enabled = false; 
				
				timerEnabled = true;
		
			} 

Just after the key press if statement, within the update method, I added this block of code that primarily deals with the timer. When the timer boolean is true, the timer is incremented every second.

Once the timer value is over 5 seconds, the health pack’s renderer and collider are re enabled again, and the healthItemEnabled variable is now true meaning that the health pack can be used again.

The timer is reset back to 0, and the timer boolean is set to false to stop the timer completely.

		if (timerEnabled == true)
		{
			timer +=Time.deltaTime;
			
			if (timer > 5)
			{
				gameObject.GetComponent<Renderer>().enabled = true; 
				gameObject.GetComponent<Collider>().enabled = true; 
				
				timerEnabled = false; 
				timer = 0f;
				healthItemEnabled = true;
				
				
			}
			
			
		}

There are probably better ways of doing this (since I’m quite new to coding in Unity C#) but I hope this helps you.

Use
C# and javascript
Destroy(gameObject);