C# problem something in hand

SO i have try make script with can put something on player hand. But not working.

and i put this code Axe object.

Here’s my try:

using UnityEngine;
using System.Collections;

public class TakeAxe : MonoBehaviour {
	
	public Transform player;
	public bool have_axe = false;
	public bool enter = false;
		
	void Update (){
	    if(have_axe == true){
			transform.position = Vector3(player.transform.position.x, player.transform.position.y, player.transform.position.z);
	    }
	
	    if(have_axe == false){
	       
	    }
	
	    if(have_axe == true){
	       if(Input.GetKeyDown("f")){
	         have_axe = !have_axe;
	       }
	    }
	}
	
	void OnTriggerEnter (Collider other){
	    if (other.gameObject.tag == "Player") {
	       (enter) = true;
	    }
	}
	
	void OnTriggerExit (Collider other){
	    if (other.gameObject.tag == "Player") {
	       (enter) = false;
	    }
	}
}

Do you have something which sets the have_axe bool externally? In this setup the have_axe property will never be true, so it will never get to transform its position.

You might want to remove the second if(have_axe == true){ when checking for trigger key so that you can actually set the have_axe to true (and to false later on), e.g.:

void Update (){
    if(have_axe == true){
        transform.position = Vector3(player.transform.position.x, player.transform.position.y, player.transform.position.z);
    } else {
        // whatever, I guess return to the default position?
    }

    if(Input.GetKeyDown("f")){
        have_axe = !have_axe;
    }
}

Also, you can directly copy the position vector from the player to the axe, no need to build a new one, but that’s beyond the scope of this question.